mozart90 Posted September 19, 2006 Share Posted September 19, 2006 (edited) Hi, I want to write filenames and the filedates in an 2-dimentional array then sort them to find out the newest files. but the sort functions fails? why? or do you have any other suggestions for realizing? I need to know the newest file in several directories. expandcollapse popup#include <Array.au3> finddoc ("C:\tty\") func finddoc($path) dim $filearray[1][2] $n=0 $search = FileFindFirstFile($path & "*.doc") ; Check if the search was successful If $search = -1 Then ;MsgBox(0, "Error", "No files/directories matched the search pattern") return EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $docdate= filegettime($path & $file,1,1) if @error=1 then msgbox(0,"","Error get time") $filearray[$n][0] = $docdate $filearray[$n][1] = $file redim $filearray[ubound($filearray,1)+1][2] $n=$n+1 WEnd ; Close the search handle FileClose($search) _ArraySort($filearray,0,1) endfunc greetings mozart90 Edited September 19, 2006 by mozart90 Easy Zip Compression using XP Link to comment Share on other sites More sharing options...
BitRot Posted September 19, 2006 Share Posted September 19, 2006 .... but the sort functions fails? why? ....... dim $filearray[1][2] .... _ArraySort($filearray,0,1) ....$i_Dim Optional: Number of occurences in the second dimension eg $A[100] = 0, $A[100][2] = 2, $A[100][5] = 5Optional here means that if you do not have a second dimension you do not need to supply it. But when you do you must fill it in. After getting the error-message (you did not mention ) a quick test revealed that. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now