gcue Posted June 3, 2008 Share Posted June 3, 2008 (edited) i am trying to find the newest zip file from multiple subdirectories i have a comination of the help file and one of zorophnog's postings but i couldnt figure out how to do two things: 1. how to account for X arrays (directories) 2. how to retain the date for each one then compare them. #Include <File.au3> #Include <Array.au3> $FileList=_FileListToArray("d:\localbackup") If @Error=1 Then MsgBox (0,"","No Files\Folders Found.") Exit EndIf _ArrayDisplay($FileList,"$FileList") MsgBox(0,"",$FileList[1]) Global $sDir, $hSearch, $sFilename, $sNewestFilename, $sNewestDate $sDir = ("$FileList[1]") If StringRight($sDir, 1) <> "\" Then $sDir &= "\" $hSearch = FileFindFirstFile($sDir & "*.zip") If $hSearch = -1 Then MsgBox(0, "Error", "No .zip files were found.") Exit EndIf While 1 $sFilename = FileFindNextFile($hSearch) If @error Then ExitLoop $sTemp = FileGetTime($sDir & $sFilename, 0, 1) If $sTemp > $sNewestDate Then $sNewestDate = $sTemp $sNewestFilename = $sFilename EndIf WEnd MsgBox(0, "Newest file", $sDir & $sNewestFilename) Edited June 3, 2008 by gcue Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 3, 2008 Share Posted June 3, 2008 i am trying to find the newest zip file from multiple subdirectoriesi have a comination of the help file and one of zorophnog's postings but i couldnt figure out how to do two things:1. how to account for X arrays (directories)2. how to retain the date for each one then compare them.Write it as a recursive function (one that calls itself). You might go see the weaponx primer on file search. Or just use the forum search function on "+recursive +search". Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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