In a modification of Donald Darden's file list code.. debug shows that on the first file of the last directory the program hangs with either no file or stream does not exist.
Anyone get this result? Any ideas?
Anyone get this result? Any ideas?
AppTitle "List all Files to Screen and disk" ; By Donald R. Darden, 2001 ; This program will print to the screen all the ; file names found on drive partitions from C: to ; Z: With some slight changes it can be modified ; for use in a Function to locate any directory or ; file on any drive upon request. Graphics 1024,768,1 filename$ = "c:\filelist.txt" fileout = WriteFile(filename$) For drive=Asc("c") To Asc("z") folderlist$= Chr(drive)+":" While folderlist$>"" a=Instr(folderList$,Chr$(0),1) If a Then folder$=Left(folderList$,a-1) folderList$=Mid$(folderList$,a+1) Else folder$=folderList$ folderList$="" End If dirhdl=ReadDir(folder$) If dirhdl=0 Then Exit Repeat file$=NextFile$(dirhdl) If file$="" Then Exit If FileType(folder$+file$)=2 Then comment$="SDir" If file$="." Or Right$(file$,2)=".." Then Goto valid EndIf folderlist$=folder$+file$+""+Chr$(0)+folderlist$ Else comment$="File" End If XText$ = folder$+file$+" "+comment$ Print XText$ WriteLine( fileout, XText$) file$=Upper(file$) For a=Asc("A") To Asc("Z") If Instr(file$,Chr$(a),1) Then Goto valid Next For a=Asc("0") To Asc("9") If Instr(file$,Chr$(a),1) Then Goto valid Next Print "["+file$+"]" ; WriteLine( fileout, file$) WaitKey .valid Forever CloseDir(dirhdl) CloseFile( fileout ) Wend Next WaitKey End