Jump to content

searching for a file


Michael36
 Share

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)
Link to comment
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]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...