Jump to content

Count files for a given date


stu22180
 Share

Recommended Posts

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:

http://www.autoitscript.com/forum/index.ph...c=58558&hl=

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

    $Array = RecursiveFileSearch(@MyDocumentsDir, "","", 1, true)
    ;_ArrayDisplay($Array)
    
    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
        EndIf
    Next

    Redim $NewArray[$nextElement]
    
    _ArrayDisplay($NewArray)
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...