Jump to content

File Searcher


Recommended Posts

Try this code.. I do all kinds of file searching and this type of code hasn't failed me yet...

CODE
findDocs("c:\","")

Func findDocs($s_path, $child_dir)

$search = FileFindFirstFile($s_path & $child_dir & "*.*")

While 1

$s_filename = FileFindNextFile($search)

If @error Then ExitLoop

$filename = $s_path & $child_dir & $s_filename

If StringInStr(FileGetAttrib($filename), "D") <> 0 Then ;Check if it is a directory by seraching the file properties

findDocs($s_path, $child_dir & $s_filename & "\")

EndIf

If StringInStr($filename,".doc") Then

WriteLog($s_path & $child_dir & $filename)

EndIf WEndEndFunc

Func WriteLog($line)

$outFile = FileOpen("c:\myDocsLog.txt", 9)

FileWriteLine($outFile, $line)

FileClose($outFile)

Return 0

EndFunc
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...