Sign in to follow this  
Followers 0
Michael36

searching for a file

5 posts in this topic

Hi all

would anyone know of a example of file searching i need to search for a file on my drive

would there be a way to make this example script search all of c drive

thank you

michael

$search = FileFindFirstFile("*.*")  

; Check if the search was successful
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

; Close the search handle
FileClose($search)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

you could use DOS

$r = _RunDOS("dir C:\ /b /s | find "*insert file name here*" >> C:\List.txt")
While 1
$x = FileReadLine("C:\List.txt")
MsgBox(0,"Found:",$x)
WEnd

i think thats right syntax not sure thou

..or you could use:

$x = _FileCountLines("C:\List.txt")
For 1 To $x
$z = FileReadLine("C:\List.txt",$x)
Next
Edited by B3TA_SCR1PT3R

[right][font="Courier New"]...Run these streets all day, I can sleep when I die.[/font] [/right]

Share this post


Link to post
Share on other sites

ok thank you i wil ltry to come up with something in all the info you gave me

michael

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