Board index » delphi » Storing directory-content to an array

Storing directory-content to an array

Hello

I would like to scan a directory for subdirectories and then store these
directorynames in an array, like with the clipper-function ADIR(). I can't
find a proper function in Delphi to do this !

Can anyone tell me the fastest way to achieve this in Delphi 4.0 ?

Thanx in advance
Roel Schrijvers

 

Re:Storing directory-content to an array


You have to realize that Clipper and Pascal are completely different. What
used to work in DOS does not necessarily have Windows equivalents. You have
to write a function/procedure to traverse the files and pick out the
directories yourself. Use FindFirst and FindNext for that. As for storing
them in an array, it is probably better to use a TStringList. That can be
sorted and worked with much easier than an array.

--

Woody
Black holes are where God divided by zero.

Adri van Bergeijk Automatisering B.V. <berge...@xs4all.nl> wrote in message
news:85hbei$glk$1@news1.xs4all.nl...

Quote
> Hello

> I would like to scan a directory for subdirectories and then store these
> directorynames in an array, like with the clipper-function ADIR(). I can't
> find a proper function in Delphi to do this !

> Can anyone tell me the fastest way to achieve this in Delphi 4.0 ?

> Thanx in advance
> Roel Schrijvers

Re:Storing directory-content to an array


Hi Roel,

As far as I know there's no single function or procedure to do this.
However, lots of Delphi books cover the topic. For example:
Charles Calvert: "Delphi 2 Unleashed". SAMS Publishing 1996, ISBN
0-672-30858-4. Page 942: The FindAllW Program.
This book was a bestseller (just like Delphi 3 Unleashed), so it shouldn't
be too difficult to find it.

Good luck!
Robin Gerrets
R.Gerr...@student.nyenrode.nl

"Adri van Bergeijk Automatisering B.V." <berge...@xs4all.nl> schreef in
bericht news:85hbei$glk$1@news1.xs4all.nl...

Quote
> Hello

> I would like to scan a directory for subdirectories and then store these
> directorynames in an array, like with the clipper-function ADIR(). I can't
> find a proper function in Delphi to do this !

> Can anyone tell me the fastest way to achieve this in Delphi 4.0 ?

> Thanx in advance
> Roel Schrijvers

Other Threads