Board index » delphi » How do you find directories on a disk?

How do you find directories on a disk?

Sorry if this question has been asked before, I was searching the news
groups for an answer to this question but only caught the end of something
which looked promising.

I am a student programming in Turbo Pascal 7 programming my final project.
My project is like a sort of File Manager only for DOS. I have stumbled over
a big problem: how do you find out what's on the hard disk? I searched the
index and could only find "Find file" but to use that I need to know the
directories.

I tried shelling out to DOS and using DIR /S /B but they're not in order, so
I tried a linked list but it gave me a headache. Any help on this would be
very gratefully accepted. If you could also post replies to my e-mail
address as well I would be grateful - I don't get my news very often!

Thanks,

Michael

--
Michael Hawkshaw    michael.hawks...@dial.pipex.com

http://ds.dial.pipex.com/town/square/xvb35/
  /|

Quote
>--+O>

  \|
 

Re:How do you find directories on a disk?


In article <6alkri$g2...@plug.news.pipex.net>,

Quote
Michael Hawkshaw <xv...@dial.pipex.com> wrote:

:Sorry if this question has been asked before, I was searching the news

You are right. It has, frequently.

:My project is like a sort of File Manager only for DOS. I have stumbled over
:a big problem: how do you find out what's on the hard disk? I searched the
:index and could only find "Find file" but to use that I need to know the
:directories.

Your problem is covered in

 132960 Dec 13 1997 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
 tsfaqp.zip Common Turbo Pascal Questions and Timo's answers

Also of interest

 320779 Oct 19 1992 ftp://garbo.uwasa.fi/pc/turbopas/tpr-book.zip
 tpr-book.zip Electronic Turbo Pascal Reference freeware book, E.Mitchell

 157497 Mar 26 1996 ftp://garbo.uwasa.fi/pc/turbopas/tptutr11.zip
 tptutr11.zip ASCII-text Turbo Pascal Tutor 1-22, G.Grotzinger, useful

   All the best, Timo

....................................................................
Prof. Timo Salmi   Co-moderator of news:comp.archives.msdos.announce
Moderating at ftp:// & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland

Spam foiling in effect.  My email filter autoresponder will return a
required email password to users not yet in the privileges database.

Re:How do you find directories on a disk?


Quote
Michael Hawkshaw wrote in message

<6alkri$g2...@plug.news.pipex.net>...

Quote
>... how do you find out what's on the hard disk? I searched the
>index and could only find "Find file" but to use that I need to know
the
>directories.

Use FindFirst and FindNext, basically as in the example in the online
help, but using the AnyFile (faAnyFile if using WinDos) attribute. For
each file name returned, examine the Attr field in the SearchRec
(WinDOS: tSearchRec) describing the file. If that attr and Directory
(aka faDirectory) <> 0 then process that directory in exactly the same
way recursively. if you want long file names in Win95 do it with the
DOS70 unit instead. Timo Salmi posted its address recently as
ftp://garbo.uwasa.fi/pc/turbspec/dos70p13.zip  The procedure names
will be different as will the SearchRec but the principle is the same.

FP

Other Threads