Jump to content

Working with file dates?


jimg
 Share

Recommended Posts

I need to check a folder to see if any of it's contents have been modified sine the last time the folder was backed up.  The folder has thousands of small files in it, so doing a _FileListtoArray, then doing a FileGetTime for each entry while finding the newest seems onerous.  Any better ways?

 

Link to comment
Share on other sites

This example may give you some ideas.

Local $fso, $file, $recentFile
Local $sPath = "C:\Users\Mal\Documents\AutoIt"
Local $sStartDate = "20130901120000" ; Time =  "2013/09/01 12:00:00"

; http://stackoverflow.com/questions/17446286/batch-script-write-date-of-oldest-file-in-a-dir-to-text-file

$fso = ObjCreate("Scripting.FileSystemObject")
For $file In $fso.GetFolder($sPath).Files
    If ($file.DateLastModified > $sStartDate) And _  ; If the file's DateLastModified is greater than (>) the specified $sStartDate Then
            StringRight($file.name, 3) == "au3" Then ; Only those fifes with "au3" extension
        ConsoleWrite($file.DateLastModified & "  " & $file.name & @LF)
    EndIf
Next
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...