View Full Version : get modified date
mondate
07-23-2007, 11:16 PM
Hi all,
Do u know any windows script that can returns filename, file length and last modified date (including second) of the file?
The dir command in windows can do that, but its modified date doesn't have second.
so, im looking for any script that can get modified date with seconds from a file in windows env.
thank you all
oracleguy
07-23-2007, 11:51 PM
You can get that information by using a vbscript and the filesystemobject. However I'm not sure if it returns the modified timestamp with seconds or not. You could try it though.
But there are pretty much ways of getting that information in any programming language.
ghostdog74
07-24-2007, 09:15 AM
Hi all,
Do u know any windows script that can returns filename, file length and last modified date (including second) of the file?
The dir command in windows can do that, but its modified date doesn't have second.
so, im looking for any script that can get modified date with seconds from a file in windows env.
thank you all
sure...here's one way
Option Explicit
Dim myFile,objFSO,objFile
myFile = "c:\temp\myfile_to_getinfo"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(myFile)
WScript.Echo "Date Created: ", objFile.DateCreated
WScript.Echo "Date Last accessed: ", objFile.DateLastAccessed
WScript.Echo "Date Last modified: ", objFile.DateLastModified
WScript.Echo "Data Last modified in secs: " , UDate(objFile.DateLastModified)
WScript.Echo "File size in bytes: ", objFile.Size
Function UDate(theDate)
UDate = DateDiff("s", "01/01/1970 00:00:00", theDate)
End Function
save it as <somename>.vbs in DOS prompt, type
c:> cscript /nologo <somename>.vbs
mondate
07-25-2007, 02:53 AM
nice..that's what i need..thank you very much
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.