BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

size of directory

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++)
View previous topic :: View next topic  
Author Message
Partaud
Guest





PostPosted: Fri Aug 05, 2005 9:34 am    Post subject: size of directory Reply with 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


Back to top
Muzaffar Mahkamov
Guest





PostPosted: Fri Aug 05, 2005 10:12 am    Post subject: Re: size of directory Reply with quote



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





PostPosted: Fri Aug 05, 2005 5:36 pm    Post subject: Re: size of directory Reply with quote




"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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Language C++) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.