Getting modification date-time of a file with seconds in cmd.exe
I've created a batch which automatically uploads some files to FTP server, if they're modified. And modification is detected by changed file's modification time and size.
But if the modification is made within the same minute, and file size did not change, modification stays unde开发者_如何学运维tected, and file is not uploaded. Is there a way to get exact modification time (including seconds) of a file in a windows batch?This is a bit of VBScript that might do it for you:
set FSO=CreateObject("Scripting.FileSystemObject")
if WScript.Arguments.Count = 0 then
Wscript.Echo "No files specified"
Wscript.Quit 1
end if
Set File=FSO.GetFile( WScript.Arguments.Item(0))
Date2=File.DateLastModified
Wscript.Echo date2
精彩评论