Jump to content
Sign in to follow this  

Count files for a given date

Recommended Posts


I would like write an autoit script to search thought a directory tree for all the files that were modified in a given date range and count this numbers of files.

Right now my mine is drawing big blank can anyone help me?



Share this post

Link to post
Share on other sites

You will first need a recursive _FileListToArray function. You will gather an array of all files first, then populate a secondary array after looping through said list.

Find a decent _FileListToArray function here:


#include <array.au3>
    #Include <Date.au3>
    #Include "RecursiveFileSearch.au3"

    $Array = RecursiveFileSearch(@MyDocumentsDir, "","", 1, true)
    Dim $NewArray[$Array[0]]
    $nextElement = 1
    For $X = 1 to $Array[0]
        $timeArray = FileGetTime($Array[$X],0,0)
        $timeString = $timeArray[0] & "/" & $timeArray[1] & "/" & $timeArray[2] & " " & $timeArray[3] & ":" & $timeArray[4] & ":" & $timeArray[5] 

        ;Add files to new array between December 1, 2007 and December 31, 2007
        If _DateDiff( 'd',"2007/12/01 00:00:00",$timeString) > 0 AND _DateDiff( 'd',"2007/12/31",$timeString) < 0 Then
            $NewArray[$nextElement] = $Array[$X]
            $NewArray[0] += 1
            $nextElement += 1

    Redim $NewArray[$nextElement]

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