Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    get modified date

    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

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    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.
    OracleGuy

  • #3
    New Coder
    Join Date
    May 2006
    Posts
    39
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by mondate View Post
    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
    Code:
    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

  • #4
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    nice..that's what i need..thank you very much


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •