Board index » delphi » Please Help this newbie

Please Help this newbie

How to read directories on harddrive, and list them in a listview, just main
directories, no subdirs.

Then I need to know how big these directories are in MB

Tanx

Jan

 

Re:Please Help this newbie


Quote
Dun Jab wrote:
> How to read directories on harddrive, and list them in a listview, just main
> directories, no subdirs.

> Then I need to know how big these directories are in MB

> Tanx

> Jan

I did the same some time ago. I used a findfirst/findnext to step through all
the files in a dir and if the are a directory then call the function recursively
again on that directory. by that you can search the whole tree. If you want to
know the size than you need to write a function that determines the size of a
dir by adding the size of all files in it, and call the function for every
subdir to add that size as well. Is pretty recursive, so watch the stack and
take care that you dont get into loops with '.' or '..' directories.

robert

Other Threads