Jump to content
Sign in to follow this  
jimg

Working with file dates?

Recommended Posts

jimg

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?

 

Share this post


Link to post
Share on other sites
Malkey

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
  • Like 1

Share this post


Link to post
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
Sign in to follow this  

×