tags:

views:

224

answers:

1

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 undetected, and file is not uploaded.
Is there a way to get exact modification time (including seconds) of a file in a windows batch?

+1  A: 

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
Igor Zevaka
I personally prefer JavaScript, but this is a great clue, since looks like there's no other solution.
alemjerus
Yeah VBScript is awful, and it's verry strange that there is no way to get timestamp with seconds precision using default tools.
Igor Zevaka