Sign in to follow this  
Followers 0
RagnaroktA

Specify working directory (FileFindFirst/NextFile)

5 posts in this topic




Have a look at FileChangeDir() in the helpfile. Or you can specify the path in FileFindFirstFile().

Share this post


Link to post
Share on other sites

See example below

$search = FileFindFirstFile("d:\autoit\*.au3")  
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
WEnd
FileClose($search)


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

See example below

$search = FileFindFirstFile("d:\autoit\*.au3")  
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
WEnd
FileClose($search)
Good example. And with FileChangeDir() is:

FileChangeDir('d:\autoit')

$search = FileFindFirstFile("*.au3")  
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
WEnd
FileClose($search)

Share this post


Link to post
Share on other sites

Good example. And with FileChangeDir() is:

FileChangeDir('d:\autoit')

$search = FileFindFirstFile("*.au3")  
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    
    MsgBox(4096, "File:", $file)
WEnd
FileClose($search)
Thanks for the replies all! I had no idea you could specify the path... and I guess I overlooked the FileChangeDir function. Sorry, I'm quite a bit off today. Thanks all!

Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
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
Sign in to follow this  
Followers 0