Re: show drive space used?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Aug 28, 2003
- 406 views
Al, Apparently it's easier than you suggested below, & *you* made it so :) You contributed a program, Get Drives, which returns all drives on a system, (or alternatively just all *fixed* drives, I think), with info about each drive, including total size & free space, which subtracted yields space used. So instead of summing all the dir space used & trying to figure how many clusters might be being used to store the dir & drive info, I just made your program into an include & used that. In fact, I'd already used it, to find what drives would be present & then display them in a user select list box. Now I'll also use it for total drive space used. Did you forget about your program? Only problem I've seen is that both your routine's return *and* just right-click and select "properties" on a drive to see windows report on drive space each sometime return different values, but then if done a few more times, they both will then agree. Weird. Dan Moyer ----- Original Message ----- From: "Al Getz" <Xaxo at aol.com> To: <EUforum at topica.com> Sent: Monday, August 25, 2003 6:24 PM Subject: RE: show drive space used? > > > Dan Moyer wrote: > > > > > > Pete, > > > > Not sure what you mean about "was it free space". The summation of > > drive > > space used for each directory was *nearly* correct. I used dir_walk (or > > walk_dir, whichever it is), (checked each dir report by hand for > > correct, > > which they were), and then summed all dirs for drive total for space > > used, > > but found that the sum wasn't correct. Turns out I probably asked about > > this a while ago, because I had started to try to account for the "." & > > ".." > > that show up in each dir, such that a cluster (or more?) is used to hold > > the > > actual directory *data*. Once I "assumed" the addition of one cluster > > per > > directory, the program *sometimes* comes out correct, depending on maybe > > how > > many actual files there are on a drive (in other words, some directories > > may > > need *more* than one cluster to hold the dir data; the drives with dirs > > that > > don't apparently need more than one cluster to hold its data, came out > > right > > for total drive space used when I added one cluster per directory, plus > > I > > think one cluster for the drive to hold the directory info, too). > > > > So apparently what I need to know now is how to figure how many clusters > > are > > used for each directory; "1" would be a minimum, but I'm not sure how to > > figure when it's more. And maybe how to know if more than one cluster > > is > > being used to hold the drive's info about its directories. > > > > Dan Moyer > > ----- Original Message ----- > > From: "Pete Lomax" <petelomax at blueyonder.co.uk> > > To: "EUforum" <EUforum at topica.com> > > Sent: Sunday, August 24, 2003 4:06 AM > > Subject: Re: show drive space used? > > > > > > > On Sun, 24 Aug 2003 03:09:38 -0700, Dan Moyer > > > <DANIELMOYER at prodigy.net> wrote: > > > > > > >but something (I don't remember what exactly) went wrong if I gave it a > > > >drive to walk through. > > > Was it free space? > > > > > > Pete > > > > > > > > > TOPICA - Start your own email discussion group. FREE! > > > > > > Hi Dan, > > If you are using FAT32 you can simply create a file of 1 byte and check > the properties in explorer (bytes used). This will tell you the size > a directory name takes up. > In NTFS, if you are using a 2GB or larger disk the units are > 4096 bytes so one directory listing probably takes 4096 bytes. > > In any case, the ratio of the directory listing space to files > space is usually low, so you can probably assume 0 and get > reasonable results unless you happen to have a lot of > directories with only a few files in them. > > This means if you do a 'dir()' in Euphoria on a directory > you should be able to add up the bytes from each file and > get results you can compare with other directories. > > If you wish, you can round the file bytes count up to the > nearest allocation unit before adding so you get actual > bytes used. This is the actual disk space used. > The formula > > if b>0 then > B=(floor(b/a)+1)*a > else > B=0 > end if > > where > b is bytes returned from 'dir()' for each file, and > a is bytes per allocation unit on that disk > B is actual bytes taken up on the disk > > should get you there if you sum up all B from all the files in > a directory. The directory name takes up one allocation unit, > so add that to the sum for that directory count. > Ignore "." and ".." . > > There is also a dos int call to find out the allocation unit size, > but im not sure if it works in NTFS and i've never used it. > > This should provide more accurate results, but if it doesnt > please let me know. > > Take care for now, > Al > > > > TOPICA - Start your own email discussion group. FREE!