-
March 6th, 2009, 04:35 PM #1
Getting file creation time in AutoIT
I am working on a script that is supposed to iterate over all the directories in a particular folder and get a file creation time. The file(s) that have the entry i am looking for are all .exe files. A sample path would be thus:
J:\groups\landeskpkgs\(Package Name)\bin\*.exe.
The code below successfully gets a listing of the subdirectories of J:\groups\landeskpkgs. Debugging even shows that I even get listings of the \bin folders when they exist. The error catching code catches the right errors in the right places. Its just when it comes down to a folder that actally has a .exe in the \bin folder, it does not put an entry in.
I know that it even gets the right file(s) from the directory - the Message Box that pops up will always give me the name of the right .exe to check. Any ideas?
Code:While $i <= $DirectoryList[0] If $i = UBound($Times) Then ReDim $Times[UBound($Times) + 1] EndIf $TempDir =_FileListToArray("J:\Groups\landeskpkgs\" & $DirectoryList[$i] & "\bin" , "*.exe") If @error=1 Then ;If no such dir from above, put "NONE" in the specified index of array. Some packages have no bin directory. $Times[$i] = "No bin folder" $i = $i + 1 ContinueLoop ElseIf @error=4 Then $Times[$i] = "No .exe in bin file" $i = $i + 1 ContinueLoop EndIf $Times[$i]=FileGetTime(""&$TempDir[1],1,1) If $debug Then $Output =_ArrayDisplay($TempDir, "Results") EndIf $i = $i + 1 WEnd
-
March 6th, 2009, 04:42 PM #2
Ha! Got it. I wasn't passing FileGetTime the FULL path. Working code:
Guess I should stare at it more before I post . . . .Code:While $i <= $DirectoryList[0] If $i = UBound($Times) Then ReDim $Times[UBound($Times) + 1] EndIf $TempDir =_FileListToArray("J:\Groups\landeskpkgs\" & $DirectoryList[$i] & "\bin" , "*.exe") $TempPath = "J:\Groups\landeskpkgs\" & $DirectoryList[$i] & "\bin\" If @error=1 Then ;If no such dir from above, put "NONE" in the specified index of array. Some packages have no bin directory. $Times[$i] = "No bin folder" $i = $i + 1 ContinueLoop ElseIf @error=4 Then $Times[$i] = "No .exe in bin file" $i = $i + 1 ContinueLoop EndIf $Times[$i]=FileGetTime($TempPath & $TempDir[1],1,1) If $debug Then $Output =_ArrayDisplay($TempDir, "Results") EndIf $i = $i + 1 WEnd
-
March 8th, 2009, 11:15 AM #3
Just making a nit-picking point here. I don't like the "If/Else" usage on the error1/error4 statement; it just doesn't look/feel right. They're independent events and really should just be coded as separate IF statements. Better yet, use an Evaluate and Case statement.
I only like using if/else on Y/N/ True/False statements; safer that way
<trust me> LOL
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Batch file to copy/rename file with current time
By jp22382 in forum Applications and Operating SystemsReplies: 2Last Post: May 19th, 2009, 06:25 AM -
Creation doesn't stand the test of time
By Beemer in forum IMO CommunityReplies: 89Last Post: April 16th, 2006, 07:45 PM -
Return Creation Date in Batch File
By BorgAssimilator in forum Applications and Operating SystemsReplies: 1Last Post: January 11th, 2005, 07:08 PM -
help file creation tool?
By ChrisK2972 in forum Applications and Operating SystemsReplies: 2Last Post: July 28th, 2003, 01:14 PM -
Office 2000 File Creation problem
By ctaylor in forum Applications and Operating SystemsReplies: 5Last Post: December 21st, 2001, 03:07 PM



LinkBack URL
About LinkBacks



Reply With Quote

The fan vote went to miss popularity Danica Patrick instead of a driver with a real chance at winning.
Is It Just Me? v233893843