 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Partaud Guest
|
Posted: Fri Aug 05, 2005 9:34 am Post subject: size of directory |
|
|
Hello,
I try to find a method to have the size of a directory, but I find only for
file, is it normal, or I don't look where it is ok?I have done search in the
help and looked at "directory operations"
Thank you for your help
Patrick
|
|
| Back to top |
|
 |
Muzaffar Mahkamov Guest
|
Posted: Fri Aug 05, 2005 10:12 am Post subject: Re: size of directory |
|
|
Partaud wrote:
| Quote: | Hello,
I try to find a method to have the size of a directory, but I find only for
file, is it normal, or I don't look where it is ok?I have done search in the
help and looked at "directory operations"
Thank you for your help
Patrick
If you need the total size of files in the given directory then you |
should implement a function that recursively traverses the directory
using FindFirst/FindNext. You could implement a traverser class that has
OnFile, OnFolder events. When OnFile event is fired, you just take
it's size and add to your variable.
Something like this:
class TTraverser
{
public:
typedef void __fastcall (__closure *TOnFile)(TSearchRec rec);
public:
TOnFile FOnFile;
TOnFile FOnFolder;
public:
Traverse(AnsiString path, bool recursive=true);
};
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Aug 05, 2005 5:36 pm Post subject: Re: size of directory |
|
|
"Partaud" <patartaud (AT) wanadoo (DOT) fr> wrote
| Quote: | I try to find a method to have the size of a directory
|
The only way to get the size of a directory is to loop through all of the
files adding their sizes together.
Gambit
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|