Sign in to follow this  
Followers 0
johns420

Searching for File Type

3 posts in this topic

I am trying to write a script that involves finding a file that may have different names but the same file extension. What would be the best way to do this? I need to be able to take the path of the file, file name and extension included, and send it out to a text box.

Thanks for the help in advance

Share this post


Link to post
Share on other sites



Use FileFindFirstFile() and FileFindNextFile():

$bleh = FileFindFirstFile("*.bat")
If $bleh = -1 Then
    MsgBox(0, "Error", "File/folder not found")
    Exit
EndIf

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

; Close the search handle
FileClose($bleh)

[font="Impact"]Cats rule, humans drool.[/font]

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