ConsultingJoe Posted November 22, 2006 Posted November 22, 2006 This goes 3 levels deep. And for some reason it won't do too many files like the windows directory but it works well. expandcollapse popup$folder = FileSelectFolder( "Select A Folder", -1, 6, @ScriptDir ) $fileout = FileSaveDialog( "Save Text File", @ScriptDir, "All (*.*)|Text files (*.txt)", 18, "file list.txt") ; Shows the filenames of all files in the current directory. $search = FileFindFirstFile($folder & "\*.*") ; Check if the search was successful $time = TimerStart() $fileout = FileOpen( $fileout, 2 ) If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") FileClose($search) FileClose($fileout) Exit EndIf While 1 $file = FileFindNextFile($search);SEARCH #1 LEVEL If @error Then ExitLoop If StringInStr( $file, "." ) Then FileWriteLine( $fileout, $file ) Else FileWriteLine( $fileout, "|" & $file ) $search2 = FileFindFirstFile($folder & "\" & $file & "\*.*") While 1 $file2 = FileFindNextFile($search2);SEARCH #2 LEVEL If @error Then ExitLoop If StringInStr( $file, "." ) Then FileWriteLine( $fileout, "-----" & $file2 ) Else FileWriteLine( $fileout, "+----" & $file2 ) $search3 = FileFindFirstFile($folder & "\" & $file & "\" & $file2 & "\*.*") While 1 $file3 = FileFindNextFile($search3);SEARCH #3 LEVEL If @error Then ExitLoop FileWriteLine( $fileout," +----" & $file3 ) WEnd EndIf WEnd EndIf WEnd ; Close the search handle FileClose($fileout) FileClose($search) $time = TimerStop( $time ) MsgBox(0, "Done", "Time to write: " & Round($time, 3) & " milliseconds") Check out ConsultingJoe.com
Thatsgreat2345 Posted November 23, 2006 Posted November 23, 2006 Smoke made a UDF to get all files no matter how many subdirectories
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