Sign in to follow this  
Followers 0
SandelPerieanu

Filesearch Problem.....

4 posts in this topic

FileDelete('search.txt')

FileWrite('search.txt', FileSearch('C:\'))

Func FileSearch($search_dir, $files = '')

$old_dir = @WorkingDir

FileChangeDir($search_dir)

$search = FileFindFirstFile('*.*')

While 1

$file = FileFindNextFile($search)

If $file = '' Then ExitLoop

$s_check = StringInStr(FileGetAttrib(StringReplace(@WorkingDir & '\' & $file, '\\', '\')), 'D')

$full_file = StringReplace(@WorkingDir & '\' & $file, '\\', '\')

Select

Case $s_check <> 0

$files &= FileSearch($full_file)

Case $s_check = 0

$files &= $full_file & @CRLF

EndSelect

WEnd

FileClose($search)

FileChangeDir($old_dir)

Return $files

EndFunc ;==>Search

ERROR:

Unable to open file, the maximum number of open files has been exceeded.

WHY?

how many is maximum?

Share this post


Link to post
Share on other sites



at a quick glance

FileDelete('search.txt')

FileWrite('search.txt', FileSearch('C:\'))

Func FileSearch($search_dir, $files = '')

$old_dir = @WorkingDir

FileChangeDir($search_dir)

$search = FileFindFirstFile('*.*')

While 1

$file = FileFindNextFile($search)

If $file = '' Then ExitLoop

$s_check = StringInStr(FileGetAttrib(StringReplace(@WorkingDir & '\' & $file, '\\', '\')), 'D')

$full_file = StringReplace(@WorkingDir & '\' & $file, '\\', '\')

Select

Case $s_check <> 0

$files &= FileSearch($full_file)

Case $s_check = 0

$files &= $full_file & @CRLF

EndSelect

WEnd

FileClose($search)

FileChangeDir($old_dir)

Return $files

EndFunc ;==>Search

the function appears to be running within itself over and over

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

solved.......

woks good and fast...my error....

FileDelete(@DesktopDir & '\Search.txt')

FileWrite(@DesktopDir & '\Search.txt', FileSearch('C:\'))

Func FileSearch($search_dir)

$allfiles = ''

$search_dir = StringReplace($search_dir & '\', '\\', '\')

$search = FileFindFirstFile($search_dir & '*.*')

While 1

$file = FileFindNextFile($search)

If $file = '' Then ExitLoop

$full_file = $search_dir & $file

$check_file = StringInStr(FileGetAttrib($full_file), 'D')

If $check_file <> 0 Then $allfiles &= FileSearch($full_file)

If $check_file = 0 Then $allfiles &= $full_file & @CRLF

WEnd

FileClose($search)

Return $allfiles

EndFunc ;==>FileSearch

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