Re: [WIN] drive space used != total file space used; whynot?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 10, 2002
- 486 views
Mr. Trick, Nope, I've been taking cluster size into account, in a non-optimal fashion, as I haven't yet been able to get an accurate programmatically determined cluster size for larger drives. For *my* drives I just put the cluster size for each drive into the program; for general use I'll have to let the user use properties to discern cluster size and select proper size and have that go into a ini file, unless I can find some better way. And I *think* I can't use usedSpace = diskSize - freeSpace() because I think freeSpace() doesn't work on a drive larger than 2 or 3 gigs, as it's dependent on cluster size, and cluster size is not correctly returned for larger drives. I may have to ignore the total drive size discrepancy, since it was directory sizes I am more concerned with, and they're accurately done. Thanks though, Dan ----- Original Message ----- From: <mistertrik at hotmail.com> To: "EUforum" <EUforum at topica.com> Sent: Sunday, February 10, 2002 12:30 PM Subject: Re: [WIN] drive space used != total file space used; whynot? > > >I'm getting that ok (verified afterward by using "properties" on each > >directory & comparing), but when I SUM UP all the space used by all > >directories (& also all files on the drive which are not in >directories), > >and compare that to what I see when I use "properties" >on the DRIVE > >itself, the "properties" says there's more space used up >on the drive than > >the summing of the directories says. > > > >So I'm wondering what I'm missing. > >Anybody got any idea what might be going on? > >Dan > > Cluster size? > > A 352 byte file will occupy 1 cluster on the disk, even though is smaller > than that. The discrepancy you are seeing may be because of this. Each file > needs to occupy a whole number of clusters, so if it uses part of a cluster, > it 'spills over' and is seen to occupy all of it. (or something like that) > Alternatively, use: > > usedSpace = diskSize - freeSpace() > > > ===================================================== > .______<-------------------\__ > / _____<--------------------__|=== > ||_ <-------------------/ > \__| Mr Trick > > > >