dabus Posted May 9, 2005 Posted May 9, 2005 So here is my code... expandcollapse popup$SearchPath=$ScanFolder&"\*" GenericSearch ( $CDir , $SearchPath ) $CDir=StringSplit( $CDir, "|") For $c=1 to $CDir[0] Step 1 $File3=$ScanFolder&"\"&$CDir[$c] $Attrib=FileGetAttrib ( $File3 ) If StringInStr($Attrib, "D") Then $SearchPath=$File3&"\*" GenericSearch ( $DDir, $SearchPath) $DDir=StringSplit( $DDir, "|") For $d=1 to $DDir[0] Step 1 $File4=$ScanFolder&"\"&$CDir[$c]&"\"&$DDir[$d] $Attrib=FileGetAttrib ( $File4 ) If StringInStr($Attrib, "D") Then FileWriteLine ( $Log1, $DDir[$d] ) FileWriteLine ( $Log2, $File4 ) EndIf Next EndIf Next Func GenericSearch ( ByRef $a, ByRef $b ) Local $File $Search = FileFindFirstFile($b) If $Search = -1 Then Exit EndIf While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop If $File="." Then ContinueLoop If $File=".." Then ContinueLoop If $File="Config" Then ContinueLoop $a=$a&"|"&$File WEnd $a=StringReplace ( $a, "|", "", 1 ) FileClose($Search) EndFunc This one drives me nuts. Sometimes the output is ok. One minute later it isn't. What the **** is wrong with it? I even get no output for Log1 even though Log2 is filled. But Log1 is just the "last" dir, Log2 is the hole path.
steveR Posted May 10, 2005 Posted May 10, 2005 (edited) You had a few mistakes. I changed it some. I didn't really test it tho, but it should give you some ideas.expandcollapse popup$SearchPath = $ScanFolder & "\*" $CDir = GenericSearch($SearchPath) $CDir = StringSplit($CDir, "|") For $c = 1 To $CDir[0] $File3 = $ScanFolder & "\" & $CDir[$c] $Attrib = FileGetAttrib($File3) If StringInStr($Attrib, "D") Then $SearchPath = $File3 & "\*" $DDir = GenericSearch($SearchPath) $DDir = StringSplit($DDir, "|") For $d = 1 To $DDir[0] Step 1 $File4 = $ScanFolder & "\" & $CDir[$c] & "\" & $DDir[$d] $Attrib = FileGetAttrib($File4) If StringInStr($Attrib, "D") Then FileWriteLine($Log1, $DDir[$d]) FileWriteLine($Log2, $File4) EndIf Next EndIf Next Func GenericSearch($path) Local $File $Search = FileFindFirstFile($b) If $Search = -1 Then Exit EndIf While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop If $File = "." Then ContinueLoop If $File = ".." Then ContinueLoop If $File = "Config" Then ContinueLoop $a = $a & "|" & $File WEnd ;~ $a = StringReplace($a, "|", "", 1) FileClose($Search) return $a EndFunc ;==>GenericSearch Edited May 10, 2005 by steveR AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
dabus Posted May 10, 2005 Author Posted May 10, 2005 Thx, I fiddled around and got it working though. I think it had something to do with a simple filehandle/filenames. I should read the manual more carefully.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now