Jump to content
Sign in to follow this  
Michael36

searching for a file

Recommended Posts

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

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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...