文件修改检查 [英] File modified Check
问题描述
大家好,
我正在寻找一个脚本,该脚本可以检查文件的最后一天是否已修改并报告是非.
你们能帮我吗,因为我对脚本编写的经验不足.
Hello everybody,
I am looking for a script that can check if an file has been modified for the last day and report an true or false.
can you guys help me since i have not much experience with scripting.
非常感谢.
推荐答案
大家好,
我正在寻找一个脚本,该脚本可以检查文件的最后一天是否已修改并报告是非.
你们能帮我吗,因为我对脚本编写的经验不足.
Hello everybody,
I am looking for a script that can check if an file has been modified for the last day and report an true or false.
can you guys help me since i have not much experience with scripting.
非常感谢.
这是用于VB Net,而不是脚本.
This is for VB Net, not scripting.
假设这就是您的意思,然后看一下FileInfo类.这是一个很好的起点:
Assuming that's what you mean then have a look at the FileInfo class. That's a good starting point:
https: //msdn.microsoft.com/zh-CN/library/system.io.fileinfo(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/system.io.fileinfo(v=vs.110).aspx
例如:
Private Function _
FileIsOlderThanOneDay(ByVal filePath As String) As Boolean
Dim retVal As Boolean = False
If Not String.IsNullOrWhiteSpace(filePath) Then
Dim fi As New IO.FileInfo(filePath)
If fi.Exists Then
retVal = (Now - fi.LastWriteTime).TotalDays > 1
End If
End If
Return retVal
End Function
这篇关于文件修改检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!