+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Ultimate Member dchw_dude's Avatar
    Join Date
    Nov 2004
    Location
    Provo, UT
    Posts
    1,356

    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

    TechIMO Folding@home Team #111 - Crunching for the cure!

  2. #2
    Ultimate Member dchw_dude's Avatar
    Join Date
    Nov 2004
    Location
    Provo, UT
    Posts
    1,356
    Ha! Got it. I wasn't passing FileGetTime the FULL path. Working code:

    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
    Guess I should stare at it more before I post . . . .

    TechIMO Folding@home Team #111 - Crunching for the cure!

  3. #3
    Caveat Emptor Rootstonian's Avatar
    Join Date
    Mar 2005
    Location
    Out of my mind
    Posts
    3,326
    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

  1. Batch file to copy/rename file with current time
    By jp22382 in forum Applications and Operating Systems
    Replies: 2
    Last Post: May 19th, 2009, 06:25 AM
  2. Creation doesn't stand the test of time
    By Beemer in forum IMO Community
    Replies: 89
    Last Post: April 16th, 2006, 07:45 PM
  3. Return Creation Date in Batch File
    By BorgAssimilator in forum Applications and Operating Systems
    Replies: 1
    Last Post: January 11th, 2005, 07:08 PM
  4. help file creation tool?
    By ChrisK2972 in forum Applications and Operating Systems
    Replies: 2
    Last Post: July 28th, 2003, 01:14 PM
  5. Office 2000 File Creation problem
    By ctaylor in forum Applications and Operating Systems
    Replies: 5
    Last Post: December 21st, 2001, 03:07 PM

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Recommended Sites: ResellerRatings Store Reviews