'=========================================================================== ' Subject: DIRECTORY TREE MAKER Date: 02-06-97 (09:22) ' Author: Terence Jordan Code: QB, QBasic, PDS ' Origin: Tjordan@ns15.cca.rockwell.com Packet: DOS.ABC '=========================================================================== 'Here you go, this program makes a _complete_ tree of a given directory. 'I found this very useful to most of my programs. 'Command line options are simple: 'maketree.exe c:\pathname\ [/i|/o filename.ext|/t filename.txt|/m mail] 'Note: pathname needs driveletter with a colon, and a backslash on the end. 'so these are valid: 'c:\ 'c:\windows\ 'a:\it\really\is\useful\ 'but these aren't: 'c: 'c:\windows 'folder\file\ 'Desc. of switches... 'switch | property '------------------------------------ '/i | invisible '/o filename.ext | output filename '/t filename.ext | tempfile filename '/m name@whatever | shelled a program called ' | "Batchmail" and mailed the ' | result to you. You'll need ' | to implement this differently ' 'last note: 'This has been tested under win95, win3.1, and the dos versions they 'accompany. DIM var$(10000) qt$ = CHR$(34) outfile$ = "log.txt" tempfile$ = "dir.txt" SHELL "Echo off" curdir$ = COMMAND$ tryagain: IF LEN(curdir$) < 3 THEN LINE INPUT "Enter directory structure: "; curdir$ GOTO tryagain END IF invisible = 0 mailto = 0 switcharoo: curdir$ = UCASE$(curdir$) switch$ = LEFT$(curdir$, 3) IF RIGHT$(curdir$, 1) = " " THEN curdir$ = LEFT$(curdir$, (LEN(curdir$) - 1)) GOTO switcharoo END IF IF LEFT$(curdir$, 1) = " " THEN curdir$ = RIGHT$(curdir$, (LEN(curdir$) - 1)) GOTO switcharoo END IF IF MID$(switch$, 2) <> ":" THEN IF switch$ = "/I " THEN invisible = 1 curdir$ = RIGHT$(curdir$, (LEN(curdir$) - 3)) GOTO switcharoo END IF IF switch$ = "/T " THEN curdir$ = RIGHT$(curdir$, (LEN(curdir$) - 3)) FOR xx = 1 TO LEN(curdir$) IF MID$(curdir$, xx, 1) = " " THEN tempfile$ = LEFT$(curdir$, xx - 1) curdir$ = RIGHT$(curdir$, (LEN(curdir$) - xx) + 1) xx = LEN(curdir$) END IF NEXT xx GOTO switcharoo END IF IF switch$ = "/O " THEN curdir$ = RIGHT$(curdir$, (LEN(curdir$) - 3)) FOR xx = 1 TO LEN(curdir$) IF MID$(curdir$, xx, 1) = " " THEN outfile$ = LEFT$(curdir$, xx - 1) curdir$ = RIGHT$(curdir$, (LEN(curdir$) - xx) + 1) xx = LEN(curdir$) END IF NEXT xx GOTO switcharoo END IF IF switch$ = "/M " THEN mailto = 1 curdir$ = RIGHT$(curdir$, (LEN(curdir$) - 3)) FOR xx = 1 TO LEN(curdir$) IF MID$(curdir$, xx, 1) = " " THEN mail$ = LEFT$(curdir$, xx - 1) curdir$ = RIGHT$(curdir$, (LEN(curdir$) - xx) + 1) xx = LEN(curdir$) END IF NEXT xx GOTO switcharoo END IF END IF IF invisible <> 1 THEN PRINT "** MakeTree 4.0! By Terence Jordan" END IF orgdir$ = curdir$ IF invisible <> 1 THEN PRINT "Creating Tree of: "; curdir$; "..."; END IF OPEN tempfile$ FOR OUTPUT AS #1 CLOSE #1 OPEN outfile$ FOR OUTPUT AS #1 PRINT #1, curdir$ CLOSE #1 mainichi: SHELL "dir " + curdir$ + "/o , > " + tempfile$ OPEN outfile$ FOR APPEND AS #2 OPEN tempfile$ FOR INPUT AS #1 WHILE NOT (EOF(1)) pr = 0 LINE INPUT #1, dummy$ dummy$ = UCASE$(dummy$) IF LEFT$(dummy$, 1) = "." THEN dummy$ = "" END IF fd = 0 IF LEN(dummy$) >= 12 THEN IF MID$(dummy$, 9, 4) <> " " THEN IF MID$(dummy$, 9, 1) = " " THEN IF LEFT$(dummy$, 1) <> " " THEN MID$(dummy$, 9, 1) = "." END IF END IF END IF END IF IF MID$(dummy$, 16, 5) = "