Directory Tree

 BBS: Inland Empire Archive
Date: 03-21-92 (03:29)             Number: 194
From: MICHAEL ORCHEKOWSKI          Refer#: 29
  To: TIM FITZGERALD                Recvd: NO  
Subj: Directory Tree                 Conf: (2) Quik_Bas
SW> TF> Once more, I need some assistance. I need someone to either
SW> TF> point me in the right direction, show me a snippet of code,
SW> TF> whatever.. of a how to get a Directory Tree, just like the
SW> TF> one provided with DOS.
SW>. . .
SW> TF> What I want it for is for a backup program I am working on.
SW> TF> I want the user to be able to tag a directory(s) for
SW> TF> backup. It would be nice if the routine could save the
SW> TF> COMPLETE paths in a variable or something. But, I can work
SW> TF> around that....
SW>. . .
SW> TF> Any help will greatly be appreciated.. so far I'm in debt
SW> TF> to a few people here.. you guys sure help people like
SW> TF> me... Thanks!

Try this:

DIM Dirs$(1000)
CMD$="CHKDSK /V|FIND "+CHR$(34)+"Directory C:\"+CHR$(34)+">TEMP.$$$"
SHELL CMD$
OPEN"TEMP.$$$" FOR INPUT AS #1
WHILE NOT EOF(1)
  DIR=DIR+1
  LINE INPUT #1,Dirs$(DIR)
WEND
CLOSE 1
KILL "TEMP.$$$"

This in effect lets you pull in the directory tree in an unsorted
fashion ... if you wanted it sorted just add a sort routine afterwards!
Just remember that the '1000' in the 'DIM Dirs(1000)' statement can be
incremented (or decremented to) as needed, and the 'C:' drivespec can be
changed as needed. Also, the variable 'DIR' is used to keep track of
how many directories you have loaded. This is so you don't have to
read in the directory count first, then DIM the Dirs$, and then load
in the directory data. (It's all handled at once) MPO.
--- RAMail 3.0
 * Origin: Old Pueblo BBS - Tucson Computer Society (1:300/2)
Outer Court
Echo Basic Postings

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