【发布时间】:2014-10-07 11:15:15
【问题描述】:
我正在运行一个从源直接复制到目标的程序。以下脚本一起运行并跳过“修改日期”等于程序运行同一天的所有文件。
我想修改脚本以跳过“创建”日期等于今天日期的任何文件,并允许任何其他文件而不考虑“修改”日期。
基本上,如果 DateCreated=Today 然后跳过
以下是我目前使用的脚本。我只是无法获得正确的语法来使用创建时间和修改时间。
提前谢谢你,
Function Description(ScriptType)
Description = "Ignores any source files modified today. Not used on Restore."
ScriptType = 2
End Function
Sub RunBeforeFileCompare(Filename, ByRef Skip)
' Ignore if this is a Restore
If SBRunning.Restore Then Exit Sub
' See if the file date is the same as todays date, skip if so
If DateDiff("d", SBRunning.GetFileDateTime(Filename, TRUE), Date) = 0 Then
Skip = TRUE
Else
Skip = FALSE
End If
End Sub
【问题讨论】:
-
我有点迷失了,因为我没有看到
Function Description的意义,它每次都返回相同的字符串并接受一个始终设置为 2 但在函数范围内丢失的参数。在您提供的代码 sn-p 中,我也没有看到对该函数的调用。无论如何...要查看文件创建时间,您可以使用此处所示的 FileSystemObject。 stackoverflow.com/questions/10189321/…。众所周知,您将需要所有代码,但它显示了如何查看文件 createdtime
标签: javascript vbscript scripting-language