'= , = , = ; = , =, = , = ,= , = '2006 by ytwinky, MD 'Tested with FB 0.183b using FBEdit; #include "windows.bi" Const Esc=!"\27", Cr=!"\r", Lf=!"\n", hell=8, Rot=4, cFG=7, cBG=0 Dim Shared As Integer x=0, y=0, Bits=0 Var i=0, j=0, Typ=0, Valid="", Fol="", FileName="", m="" 'Declare Function GetDriveType Alias "GetDriveTypeA" (ByVal nDrive As STRING) As INTEGER Dim LwTyp(5) As ZString Ptr=>{@"Unknown", @"Missing", @"Floppy", @"HardDisk", @"NetDrive", @"CD/DVD"} Sub PrintAt(byVal WoZe As Integer, byVal WoSp As Integer, byVal Was As String, byVal WieFG As Integer=-1, byVal WieBG As Integer=-1) Dim As Integer sp=Pos(0), ze=CsrLin If WieFG<0 Then WieFG=cFG If WieBG<0 Then WieBG=cBG Color WieFG, WieBG Locate WoZe, WoSp Print Was; Color cFG, cBG Locate ze, sp End Sub Function MenuChar(byVal s As String, byVal First As Integer=1, byVal nVG As Integer=Hell+Rot) As String If First<>1 Then ?Left(s, First-1); Color nVG, 0 Print Chr(s[First-1]); Color 7, 0 Return Mid(s, First+1) End Function Sub Help() PrintAt(1, 40, "Help", Hell+3) PrintAt(2, 40, "Nothing special:") Locate 3, 40:?MenuChar("Use the Menu-Keys to select", 9) End Sub Sub SaveAll(byVal FileName As String, byVal Contents As String) Dim FilePtr As Integer=FreeFile Open FileName For Binary As #FilePtr Put #FilePtr,, Contents Close #FilePtr End Sub Function FindFiles(byVal Folder As String, byRef i As Integer, Erw As String="") As String Dim ffd As WIN32_FIND_DATA Dim Attr As Integer Dim As String s="" If Folder[Len(Folder)-1]<>92 Then Folder+="\" Dim As HANDLE hFind=FindFirstFile(Folder &"*", @ffd) If hFind=INVALID_HANDLE_VALUE Then s+="Ooops, no success for " &Folder Else Do If ffd.cFileName<>"." And ffd.cFileName<>".." Then Attr=ffd.dwFileAttributes And 255 If Attr And FILE_ATTRIBUTE_DIRECTORY Then s+=Hex(Attr) &" " &Folder &ffd.cFileName &Lf s+=FindFiles(Folder &ffd.cFileName, i) Else s+=Hex(Attr) &" " &Folder &ffd.cFileName &Lf End If i+=1 End If Loop While FindNextFile(hFind, @ffd) FindClose hFind End If Return s End Function Print "Filelist of drives" Print "Valid drives:" For i=1 To 26 Typ=GetDriveType(Chr(64+i)+":") If Typ<>1 Then Print MenuChar("[ ] Drive " &Chr(64+i) &": Type:", 11); If Typ=2 Then Print "Disk/Usb" Else Print *LwTyp(Typ) Valid+=Chr(64+i) End If Next Valid+="*" &"?" &Cr &Esc Print MenuChar(" All *", 11) 'is NOW a toggle ;-)) Print !" ?=Help(F1)\n Enter=ListFiles\n Esc=Quit\n Select:"; x=CsrLin Do Locate x, 12 Do Sleep 1 m=UCase(InKey) j=Instr(Valid, m) If m=Chr(255, 59) Then Help() Loop Until j<>0 Select Case Instr(Valid, m) Case 0 Case Len(Valid): End 'Esc Case Len(Valid)-1: 'Cr Case Len(Valid)-2: Help() '? Case Len(Valid)-3: '* If Bits<>0 Then For j=1 To Len(Valid)-4 Bits=BitReset(Bits, j) Locate 2+j, 2 Print " " Next Else For j=1 To Len(Valid)-4 Bits=BitSet(Bits, j) Locate 2+j, 2 Print "*" Next End If Case Else Locate 2+j, 2 If Bit(Bits, j) Then Bits=BitReset(Bits, j) Print " " Else Print "*" Bits=BitSet(Bits, j) End If End Select If m=Esc Then End Loop Until m=Cr Print !"\nFiles will be stored in " &Environ("Tmp") &"\Drive-*.Lst, Ctrl-C to Quit:" Input "FolderName(if desired):", Fol If Fol="" Then Fol=Environ("Tmp") If Fol[Len(Fol)-1]<>92 Then Fol+="\" If Bits=0 Then Print "Nothing to list.." Else For i=1 To Len(Valid)-2 If Bit(Bits, i) Then FileName=Fol &"Drive-" &Chr(Valid[i-1]) &".Lst" SaveAll(FileName, FindFiles(Chr(Valid[i-1]) &":", j)) Print FileName End If Next End If Print "Eniki.."; GetKey