BBS: Inland Empire Archive Date: 04-14-92 (16:46) Number: 80 From: MICHAEL MALLEY Refer#: NONE To: ALL Recvd: NO Subj: Recursive Directory 3/ Conf: (2) Quik_Bas
>>> Continued from previous message ErrorLevel = ErrorLevel XOR ErrorLevel MID$(Levels, Position) = CHR$(ErrorLevel) IF NOT ShowFiles OR FirstTime THEN GOSUB DrawTree PRINT TAB(Column); CHR$(192); STRING$(1, 196); Directory$ ExitFlag = True ShowTree PathSpec$ + "\" + Directory$, Position + 1 END IF LOOP UNTIL ExitFlag END IF EXIT SUB DrawTree: '--- This method of drawing the tree will allow for all nested ' levels of subdirectories, up the the DOS maximum of 32, to ' be shown on the screen without the screen wrapping and ' extra carraige returns that TREE.COM does. It also shows ' all directories graphically which is better than the way ' PC Tools handles it. '--- Allow user termination by looking for <CTRL>+C DO KeyStroke = INKEY$ IF LEN(KeyStroke) THEN IF ASC(KeyStroke) = 3 THEN END ELSE EXIT DO END IF LOOP FOR Counter = 1 TO Position - 1 '--- Use TAB instead of LOCATE so device redirection works PRINT TAB(((Counter - 1) * 2) + 1); IF ASC(MID$(Levels, Counter, 1)) THEN PRINT CHR$(179); NEXT Counter RETURN ListFiles: FirstTime = NOT FirstTime FileName$ = GetFile(PathSpec$ + "\*.*" + CHR$(0), ScratchDTA, True) DO WHILE LEN(FileName$) GOSUB DrawTree IF ASC(MID$(Levels, Position, 1)) THEN PRINT TAB(Column); CHR$(179); TAB(Column + 3); ELSE PRINT TAB(Column + 2); END IF PRINT FileName$ FileName$ = GetFile("", ScratchDTA, True) LOOP ErrorLevel = ErrorLevel XOR ErrorLevel RETURN END SUB * SLMR 2.1a * He's got a magnet! Everybody BACKUP!!! - Cmdr. Data --- Maximus 2.01wb * Origin: UltraTech - Nashville, TN (615) 356-0453 {HST} (1:116/30)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET