Article View: borland.public.cppbuilder.nativeapi
Article #14999Re: Is there any simple API function to find out the space used by a directory
From: Michael Kelly
Date: Sun, 20 Jul 2003 20:00
Date: Sun, 20 Jul 2003 20:00
25 lines
2035 bytes
2035 bytes
On Sun, 20 Jul 2003 23:39:11 +0800, "Emmanuel" <emmanuel@erphk.com> wrote:
>Is there any simple API function to find out the space used by a directory?
>
Nope. What you have to do is recursively go through the directory
with FindFirstFile/FindNextFile type functions and add up the file
sizes. The other thing you have to decide is if you just want to
know the total of the file sizes, or the actual space taken away
from the file system on that drive. IOW, there is a cluster size
used by the file system, and if you divide the file size by the
cluster size, any non-zero remainder means you have to
increment the count of the clusters used. As example
if you have a slew of 10 byte files in a directory, they
might actually use 4KB or 8 KB or whatever, apiece
on that file system.
Depends on exactly what you are doing if you need
to account for cluster size or not.
--
"I don't want to belong to any club that would have me as a member."
-- Groucho Marx
Technical Details
Message-ID:
<k6tlhvcj685q8toj54p262pek3pkvjmese@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f1ab7a2@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,37ac4db4bc556140 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-20 13:09:31 PST From: Michael Kelly <mkelly2002@adelphia.net> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Is there any simple API function to find out the space used by a directory Date: Sun, 20 Jul 2003 16:00:47 -0400 Message-ID: <k6tlhvcj685q8toj54p262pek3pkvjmese@4ax.com> References: <3f1ab7a2@newsgroups.borland.com> X-Newsreader: Forte Agent 1.92/32.572 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 68.68.251.232 X-Trace: newsgroups.borland.com 1058731552 68.68.251.232 (20 Jul 2003 13:05:52 -0700) Lines: 25 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail