'=========================================================================== ' Subject: GET DRIVE TREE Date: 12-01-92 (05:15) ' Author: Jerry Aldrich Code: QB, QBasic, PDS ' Keys: GET,DRIVE,TREE Packet: DOS.ABC '=========================================================================== 'It will NOT work on a Mono system, due to the 'fact it uses 2 video pages, but it works just fine with color. The 'resulting program will scan the same drive in 16.7 Seconds (compiled) or '19.5 seconds in the environment. And it's ALL QB code! Here 'tis: DECLARE SUB GetDirs (Path$, Level%) DECLARE SUB ShowTree () DEFINT A-Z ' Dimension Array to Hold Directories and Variable for Number of Dirs DIM SHARED Path$(300), DCnt ' Set Active and Visual Pages to 1 and Clear Screen SCREEN 0, , 1, 1: CLS ' Prompt User for Drive Letter and Prepare Screen PRINT "Get Tree For Which Drive :"; DO: Drive$ = UCASE$(INKEY$): LOOP UNTIL LEN(Drive$): PRINT Drive$ PRINT "Scanning Drive " + Drive$ + " :" ' Set Frist Path to Root and Directory Count to 1 Path$(1) = Drive$ + ":": DCnt = 1 ' Send Output to Page 0 (hide it) SCREEN 0, , 0, 1 ' Start Recursive Directory Scan GetDirs Path$(1), 1 ' Clear Screen and Set OutPut Back to Page 1 and Show Tree CLS : SCREEN 0, , 1, 1 ShowTree ' Set All Pages to 0 and End SCREEN 0, , 0, 0 END SUB GetDirs (Path$, Level) ' Clear Screen, Display Sub Directories in Path$, Find out Last Line CLS : FILES RTRIM$(Path$) + "\*.": LastLin = CSRLIN - 3 ' Start Scanning Each Line of the Screen for Directory Entries FOR Lin = 1 TO LastLin FOR Col = 0 TO 3 ' Start with Column Offset of 0 D$ = "" ' Clear Temp Character Variable DEF SEG = &HB800 ' Set Default Segment to Video Memory ' Read One Entry (17 Characters) From Video Memory FOR Char = 0 TO 34 STEP 2 D$ = D$ + CHR$(PEEK(Lin * 160 + Col * 36 + Char)) NEXT DEF SEG ' Set Default Segement Back to QB Data ' If Entry is a Sub Directory IF INSTR(D$, "