1. show drive space used?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Aug 23, 2003
- 423 views
Has anyone written a utility to see/show how much space each directory & selected sub-directories have used on a drive? I tried to do that once a while ago, but for some reason it only worked right if you selected a directory, not if you selected a whole drive to analyze. Dan Moyer
2. Re: show drive space used?
- Posted by rolf at rschr.de Aug 23, 2003
- 408 views
This is a multi-part message in MIME format. --------------BD8683449589B49DA7C1B9E1 Hi Dan do you mean this kind of program? Have a nice day, Rolf ps: right clicking on a DIR under the Win explorer will also show you the content of the DIR and sub dirs. --------------BD8683449589B49DA7C1B9E1 Content-Type: application/x-unknown-content-type-EUWinApp; name="Dirsize.exw"
3. Re: show drive space used?
- Posted by rolf at rschr.de Aug 23, 2003
- 425 views
Peter Willems wrote: >=20 > rolf at rschr.de wrote: >=20 > > Hi Dan > > > > do you mean this kind of program? > > > > Have a nice day, Rolf > > > > ps: right clicking on a DIR under the Win explorer will also show you > > the content of the DIR and sub dirs. >=20 > I bet the program you are talking about was attached to your > message, posted from a mail client. So this is yet another > great feature of Topica (NOT!): it strips attachments so messages > like yours doesn't make any sense when using Topica's web > interface. Peter, you are absolutely right! Therefor I sent the attachment additionally directly to Dan's address. And I include it now directly into this mail . . . . Have a nice day, Rolf Start of EU code: ---------------------------------------------------------------------------= -- -- Rolf Schr=F6der 2003-= 07-6 --> DIRSIZE.EXW Content of DIR and all SUBDIRs. M=F6=F6rkenweg 37 -- =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF = 21029 Hamburg, Germany -- Language: EUPHORIA ver. 2.3 rolf at rschr.de ---------------------------------------------------------------------------= --- without type_check include file.e -- dir(), current_dir(), chdir() include get.e -- wait_key() include graphics.e -- get_position(), cursor() ---------------------------------------------------------------------------= --- integer rotnum -- needed for procedure rotator() sequence rotchar -- needed for procedure rotator() sequence keep_cuspos -- needed for procedure rotator() rotnum =3D 0 rotchar =3D {'-','\\','|','/'} procedure rotator() -- Needs local sequence keep_cuspos, -- =AF=AF=AF=AF=AF=AF=AF local initialized integer rotnum= , and -- local initialized sequence rotchar, i.e.: -- -- rotnum =3D 0 -- rotchar =3D {'-','\\','|','/'} -- keep_cuspos =3D get_position() -- position of 'normal' outpu= t rotnum =3D remainder(rotnum + 1,length(rotchar)) puts(1,rotchar[rotnum + 1]) position( keep_cuspos[1], keep_cuspos[2]) -- return to initial cuspos end procedure ---------------------------------------------------------------------------= --- function dirsize(sequence rootdir) -- Returns sum of all file sizes=20 -- =AF=AF=AF=AF=AF=AF=AF from rootdir and all s= ubdirs. object x sequence s atom bytes =20=20=20=20 if rootdir[length(rootdir)] !=3D '\\' then=20=20=20=20 rootdir &=3D '\\' -- Append '\\' at end of DIR string end if x =3D dir(rootdir & "*.*") -- Get DIR information of all files= =20 bytes =3D 0 if sequence(x) then -- Exclude forbidden DIRs for i =3D 1 to length(x) do -- Loop through DIR content s =3D x[i] if find('d',s[2]) then -- Check for SubDIRs if not (equal(s[1],".") or equal(s[1],"..")) then bytes +=3D dirsize(rootdir & s[1]) end if else bytes +=3D s[3] -- Sum Bytes!=20 end if end for end if rotator() -- Activity indicator if get_key() =3D 27 then -- Choice to abort=20 cursor(UNDERLINE_CURSOR) puts(1,"Aborted by ESC-key. Press any key . . .") x =3D wait_key() abort(0) end if return bytes end function ---------------------------------------------------------------------------= --- procedure main() -- =AF=AF=AF=AF=20=20 integer k atom bytes, a sequence s, rootdir =20=20=20=20 s =3D command_line() if length(s) < 3 then -- No dir given rootdir =3D current_dir() else -- Dir given via parameter rootdir =3D s[3] end if k =3D chdir(rootdir) if k then -- Dir exists rootdir =3D current_dir() else -- Dir doesn't exist puts(1,"Couldn't find \"" & rootdir & "\". Abort.\n\n") puts(1," press any key . . .") k =3D wait_key() return end if if rootdir[length(rootdir)] !=3D '\\' then -- Dir should end with '\= \' rootdir &=3D '\\' end if puts(1,"Size of \"" & rootdir &=20 "\" (All visible FILEs/SUBDIRs. Abort by ESC.):\n\n") cursor(NO_CURSOR) bytes =3D dirsize(rootdir) cursor(UNDERLINE_CURSOR) printf(1,"%d Bytes",bytes) s =3D {"KB","MB","GB","TB"} for i =3D 1 to 4 do a =3D power(1024,i) if bytes >=3D a then printf(1," =3D %.3f %s",{bytes/a,s[i]}) else exit end if end for puts(1,"\n\n press any key . . .") k =3D wait_key() end procedure ---------------------------------------------------------------------------= --- main() abort(0) ---------------------------------------------------------------------------= --- End of EU code.
4. Re: show drive space used?
- Posted by rolf at rschr.de Aug 23, 2003
- 420 views
Topica is s... ! I send it now to rob for the archive. Have a nice day, Rolf
5. Re: show drive space used?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Aug 24, 2003
- 423 views
Hi Rolf, Thanks, that's a very interesting program. I couldn't figure out what "rotator" was for until I ran it on c: drive :) cute! But not really what I wanted...I need to clean my drive up so it's not filled, so I wanted to see what was taking up how much space, per directory (with a program, not by hand, looking at each dir, one after another). I made a program once that walked the directory tree, and I checked the results by right click on a folder as you also suggested, and it worked fine as I remember, *except* when I tried to apply it to a *drive* rather than just a directory; if I applied it to any directory, it gave correct results, but something (I don't remember what exactly) went wrong if I gave it a drive to walk through. I think it reported wrong sum of total space used on the drive, and may have also reported wrong values for some directories (only when applied to a drive, worked ok when applied just to a directory). I also think I had it put the space used into a tree of the directories & sub-directories, sorted by biggest first. Too bad it didn't work completely. Maybe I'll dust it off & see if I can figure what went wrong. Dan Moyer ----- Original Message ----- From: <rolf at rschr.de> To: "EUforum" <EUforum at topica.com> Sent: Saturday, August 23, 2003 12:50 AM Subject: Re: show drive space used? > > Hi Dan > > do you mean this kind of program? > > Have a nice day, Rolf > > ps: right clicking on a DIR under the Win explorer will also show you > the content of the DIR and sub dirs. > > > > TOPICA - Start your own email discussion group. FREE! >
6. Re: show drive space used?
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Aug 24, 2003
- 418 views
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.=20 Was it free space? Pete
7. Re: show drive space used?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Aug 25, 2003
- 410 views
Al, I could, which is what I think Rolf did, but I already made a big start on doing it with dir_walk (or walk_dir, whichever it is). It works ok with each directory, my problem was with summing them to get to the actual whole drive space used; turns out I didn't take into account the space used to *hold* each directory's data, (one or more clusters each), and a cluster or more for the drive itself to hold directory info. Any idea how I could know how many clusters are used per directory & per drive for file/dir data? Dan Moyer ----- Original Message ----- From: "Al Getz" <Xaxo at aol.com> To: <EUforum at topica.com> Sent: Sunday, August 24, 2003 3:44 AM Subject: RE: show drive space used? > > > Dan Moyer wrote: > > > > > > Hi Rolf, > > > > Thanks, that's a very interesting program. I couldn't figure out what > > "rotator" was for until I ran it on c: drive :) cute! > > > > But not really what I wanted...I need to clean my drive up so it's not > > filled, so I wanted to see what was taking up how much space, per > > directory > > (with a program, not by hand, looking at each dir, one after another). > > I > > made a program once that walked the directory tree, and I checked the > > results by right click on a folder as you also suggested, and it worked > > fine > > as I remember, *except* when I tried to apply it to a *drive* rather > > than > > just a directory; if I applied it to any directory, it gave correct > > results, > > but something (I don't remember what exactly) went wrong if I gave it a > > drive to walk through. I think it reported wrong sum of total space > > used on > > the drive, and may have also reported wrong values for some directories > > (only when applied to a drive, worked ok when applied just to a > > directory). > > I also think I had it put the space used into a tree of the directories > > & > > sub-directories, sorted by biggest first. Too bad it didn't work > > completely. Maybe I'll dust it off & see if I can figure what went > > wrong. > > > > Dan Moyer > > > > ----- Original Message ----- > > From: <rolf at rschr.de> > > To: "EUforum" <EUforum at topica.com> > > Sent: Saturday, August 23, 2003 12:50 AM > > Subject: Re: show drive space used? > > > > > > > Hi Dan > > > > > > do you mean this kind of program? > > > > > > Have a nice day, Rolf > > > > > > ps: right clicking on a DIR under the Win explorer will also show you > > > the content of the DIR and sub dirs. > > > > > > > > > TOPICA - Start your own email discussion group. FREE! > > > > > > Hi there Dan, > > Can you just go through all the directories, adding up all > the byte counts returned from each file using dir() ? > > > Take care for now, > Al > > > > TOPICA - Start your own email discussion group. FREE!
8. Re: show drive space used?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Aug 25, 2003
- 428 views
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! >
9. Re: show drive space used?
- Posted by euman at bellsouth.net Aug 25, 2003
- 409 views
--Alt-Boundary-7427.30580187 Content-description: Mail message body On 24 Aug 2003 at 23:03, Dan Moyer wrote: > > > Al, > > I could, which is what I think Rolf did, but I already made a big start on > doing it with dir_walk (or walk_dir, whichever it is). It works ok with > each directory, my problem was with summing them to get to the actual whole > drive space used; turns out I didn't take into account the space used to > *hold* each directory's data, (one or more clusters each), and a cluster or > more for the drive itself to hold directory info. > > Any idea how I could know how many clusters are used per directory & per > drive for file/dir data? > > Dan Moyer http://www.sysinternals.com/ntw2k/info/defrag.shtml Euman --Alt-Boundary-7427.30580187 Content-type: text/html; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body <?xml version="1.0" ?><html> <head> <title></title> </head> <body> <div align="left"><font face="Arial"><span style="font-size:10pt">On 24 Aug 2003 at 23:03, Dan Moyer wrote:</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> ============ The Euphoria Mailing List ============ </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Al,</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> I could, which is what I think Rolf did, but I already made a big start on</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> doing it with dir_walk (or walk_dir, whichever it is). It works ok with</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> each directory, my problem was with summing them to get to the actual whole</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> drive space used; turns out I didn't take into account the space used to</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> *hold* each directory's data, (one or more clusters each), and a cluster or</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> more for the drive itself to hold directory info.</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Any idea how I could know how many clusters are used per directory & per</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> drive for file/dir data?</span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> </span></font></div> <div align="left"><font face="Arial" color="#7f0000"><span style="font-size:10pt">> Dan Moyer</span></font></div> <div align="left"><br/> </div> <div align="left"><font face="Arial" color="#00007f"><span style="font-size:10pt">http://www.sysinternals.com/ntw2k/info/defrag.shtml</span></font></div> <div align="left"><br/></div> <div align="left"><font face="Arial"><span style="font-size:10pt">Euman</span></font></div> <div align="left"><br/> </div> <div align="left"></div> --Alt-Boundary-7427.30580187--
10. Re: show drive space used?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Aug 28, 2003
- 405 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!
11. Re: show drive space used?
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 29, 2003
- 421 views
[snip] > > Hello again Dan, > > As you probably already know, there are two standards for > defining a megabyte. > > 1. 1 megabyte=1,000,000 bytes > 2. 1 megabyte=1,048,576 bytes (1024*1024) Define 'standard'. If you mean an offical publication from an acknowledged standards body, then megabyte is 2 raised to the power 20 (1024 * 1024 = 1048576) bytes. The layman's term is used by advertisers to mean approximately one million bytes. > Hard disk manufacturers use #1 while memory uses #2. I disagree and would need proof of this assestion before changing my mind. The disk manufacturers tend to place the unformatted size on their disk's documentation. Formatting a disk will always take up some of this. > This means if you want to store a block of memory say > 4096 bytes (4kb) long on disk, it's going to take more > then 4kb to store it on disk! In fact, it takes 4.096kb > on disk. Respectfully I again have to disagree. When I write a disk file that contains 4096 bytes, the amount of disk space used depends on the sector size in use. Using a 4KB sector size means that I can exactly use one sector of disk space, except in the rare circumstance when creating a new file causes the directory to expand over into a new sector too. Plus 4.096KB is 4194.304 bytes, and I'm not sure if disks can store partial bytes. A KB is still 1024 bytes is it not? > Since i wanted to show bytes used using the > memory standard, i used the conversion factor 1/1024 > instead of 1/1000. Which is the better (consistant) approach, IMHO. > It makes sense to use the disk standard, but it also makes > sense to use the memory standard because this tells you how much space > you have for storing memory. Using the > memory standard tells you that after you create a file > such as a bitmap that uses 32k bytes you will be using > 32k bytes of disk space when it's saved to a file. > Using the disk standard, after you create a file using > 32k bytes in mem you will be using up 32.768k bytes on disk, > which brings in a conversion factor. It all depends > on how you want to look at it. Rubbish. Sector size has more influence on disk space usage. > What i SHOULD have done was define a constant that allowed > the user to select which they wanted to use in their program, > memory or disk standard. > > > If you want to see the bytes count match up with the > file/properties listing, it really should be quite easy... > > In function: > GetDriveInfo() > change: > kbdiv=1/1024 > to: > kbdiv=1/1000 > > This means the returned info will match what the MS properites > dialog turns up. MS reports disk memory in MB (1024 * 1024) units. > As a final note, you may have to run scandisk to see a perfect match > (to the nearest 1000 bytes). Rubbish. All the operating system tools display this info using 1024=KB and 1048756=MB units. However I'm willing to be corrected. Just show me the proof. -- cheers, Derek Parnell
12. Re: show drive space used?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Aug 29, 2003
- 398 views
Al, Yes, your function *does* just show info for a drive (or drives) as a whole, and I do want to look at *each* directory to see exactly which ones are using the most space. And I've done that, mostly satisfactorily, using walk_dir(). But your function is useful because I can forget about having to sum all the directory sizes together, and trying to also take into account how many extra clusters of drive space would be being used to *hold* all the dir/drive info, in order to show the whole drive space used. Now I just use walk_dir() to get each directory's size, & your "GetHardDiskDrivesInfo()" function to get the whole drive space used. The funny thing is, I had *already* used your function in the program in order to find out which drives were on a system, so as to put them into a list so user could choose which drive to scan! Only slight problem remaining is that sometimes *both* your function *and* the windows "right click on drive, select properties" return apparently wrong drive size info. Somehow if I persist in looking both ways, they eventually return the same size, presumably then correct. It may just be that because my program is writing out a debug file, that may be messing up one or another of the drive space used report. Dan Moyer ----- Original Message ----- From: "Al Getz" <Xaxo at aol.com> To: <EUforum at topica.com> Sent: Thursday, August 28, 2003 9:13 PM Subject: RE: show drive space used? > > > Dan Moyer wrote: > > > > > > 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 <snip> > Hi there Dan, > > I remember something about that, but didnt it just show > the drive space as a whole? I thought you wanted to > look at individual directories and do a report that > shows which directories use the most bytes to help > decide what to move to another drive, or something like > that. > > I'll have to take a new look at the program, if i can find > it now... > > Take care for now, > Al > > > > TOPICA - Start your own email discussion group. FREE!
13. Re: show drive space used?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Aug 29, 2003
- 427 views
Al, I think maybe Elliott is right, the report from your function is already accurate with respect to file/properties report ? And I don't see a dos screen, because I turned your program into an include & just use the functions! :) Dan Moyer ----- Original Message ----- From: "Al Getz" <Xaxo at aol.com> To: <EUforum at topica.com> Subject: RE: show drive space used? > > > Al Getz wrote: > > > > > > Dan Moyer wrote: > > > > > > > > > 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! > > > > > > > > Hi there Dan, > > > > I remember something about that, but didnt it just show > > the drive space as a whole? I thought you wanted to > > look at individual directories and do a report that > > shows which directories use the most bytes to help > > decide what to move to another drive, or something like > > that. > > > > I'll have to take a new look at the program, if i can find > > it now... > > > > Take care for now, > > Al > > Hello again Dan, > > As you probably already know, there are two standards for > defining a megabyte. > > 1. 1 megabyte=1,000,000 bytes > 2. 1 megabyte=1,048,576 bytes (1024*1024) > > Hard disk manufacturers use #1 while memory uses #2. > This means if you want to store a block of memory say > 4096 bytes (4kb) long on disk, it's going to take more > then 4kb to store it on disk! In fact, it takes 4.096kb > on disk. Since i wanted to show bytes used using the > memory standard, i used the conversion factor 1/1024 > instead of 1/1000. > It makes sense to use the disk standard, but it also makes > sense to use the memory standard because this tells you > how much space you have for storing memory. Using the > memory standard tells you that after you create a file > such as a bitmap that uses 32k bytes you will be using > 32k bytes of disk space when it's saved to a file. > Using the disk standard, after you create a file using > 32k bytes in mem you will be using up 32.768k bytes on disk, > which brings in a conversion factor. It all depends > on how you want to look at it. > > What i SHOULD have done was define a constant that allowed > the user to select which they wanted to use in their program, > memory or disk standard. > > > If you want to see the bytes count match up with the > file/properties listing, it really should be quite easy... > > In function: > GetDriveInfo() <snip> > >
14. Re: show drive space used?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Aug 29, 2003
- 430 views
Derek, Can't give you the proof you would like, but if my memory serves me, various times I've installed new HD's, I've actually seen the "disclaimer" with or on the drive that says they're using 1,000,000 bytes to mean 1 megabyte. Don't have a bare drive handy to look at, though. Dan Moyer ----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> To: "EUforum" <EUforum at topica.com> Subject: Re: show drive space used? > > > [snip] > > > > Hello again Dan, > > > > As you probably already know, there are two standards for > > defining a megabyte. > > > > 1. 1 megabyte=1,000,000 bytes > > 2. 1 megabyte=1,048,576 bytes (1024*1024) > > Define 'standard'. If you mean an offical publication from an acknowledged > standards body, then megabyte is 2 raised to the power 20 (1024 * 1024 = > 1048576) bytes. The layman's term is used by advertisers to mean > approximately one million bytes. > > > > Hard disk manufacturers use #1 while memory uses #2. > > I disagree and would need proof of this assestion before changing my mind. > The disk manufacturers tend to place the unformatted size on their disk's > documentation. Formatting a disk will always take up some of this. > > > This means if you want to store a block of memory say > > 4096 bytes (4kb) long on disk, it's going to take more > > then 4kb to store it on disk! In fact, it takes 4.096kb > > on disk. > > Respectfully I again have to disagree. When I write a disk file that > contains 4096 bytes, the amount of disk space used depends on the sector > size in use. Using a 4KB sector size means that I can exactly use one > sector of disk space, except in the rare circumstance when creating a new > file causes the directory to expand over into a new sector too. > > Plus 4.096KB is 4194.304 bytes, and I'm not sure if disks can store > partial bytes. A KB is still 1024 bytes is it not? > > > > Since i wanted to show bytes used using the > > memory standard, i used the conversion factor 1/1024 > > instead of 1/1000. > > Which is the better (consistant) approach, IMHO. > > > It makes sense to use the disk standard, but it also makes > > sense to use the memory standard because this tells you how much space > > you have for storing memory. Using the > > memory standard tells you that after you create a file > > such as a bitmap that uses 32k bytes you will be using > > 32k bytes of disk space when it's saved to a file. > > Using the disk standard, after you create a file using > > 32k bytes in mem you will be using up 32.768k bytes on disk, > > which brings in a conversion factor. It all depends > > on how you want to look at it. > > Rubbish. Sector size has more influence on disk space usage. > > > What i SHOULD have done was define a constant that allowed > > the user to select which they wanted to use in their program, > > memory or disk standard. > > > > > > If you want to see the bytes count match up with the > > file/properties listing, it really should be quite easy... > > > > In function: > > GetDriveInfo() > > change: > > kbdiv=1/1024 > > to: > > kbdiv=1/1000 > > > > This means the returned info will match what the MS properites > > dialog turns up. > > MS reports disk memory in MB (1024 * 1024) units. > > > As a final note, you may have to run scandisk to see a perfect match > > (to the nearest 1000 bytes). > > Rubbish. All the operating system tools display this info using 1024=KB > and 1048756=MB units. > > > However I'm willing to be corrected. Just show me the proof. > > -- > > cheers, > Derek Parnell > > > > TOPICA - Start your own email discussion group. FREE! >
15. Re: show drive space used?
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 29, 2003
- 418 views
----- Original Message ----- From: "Al Getz" <Xaxo at aol.com> To: <EUforum at topica.com> Subject: RE: show drive space used? > > Hello Derek, > > > Derek Parnell wrote: > > > > > > [snip] > > > > > > Hello again Dan, > > > > > > As you probably already know, there are two standards for > > > defining a megabyte. > > > > > > 1. 1 megabyte=1,000,000 bytes > > > 2. 1 megabyte=1,048,576 bytes (1024*1024) > > > > Define 'standard'. If you mean an offical publication from an > > acknowledged > > standards body, then megabyte is 2 raised to the power 20 (1024 * 1024 = > > > > 1048576) bytes. The layman's term is used by advertisers to mean > > approximately one million bytes. > > > > > > > Hard disk manufacturers use #1 while memory uses #2. > > > > I disagree and would need proof of this assestion before changing my > > mind. > > The disk manufacturers tend to place the unformatted size on their > > disk's > > documentation. Formatting a disk will always take up some of this. > > > > Perhaps on the Western Digital site? Yes. I found this on their site "Western Digital defines a megabyte (MB) as 1,000,000 bytes and a gigabyte (GB) as 1,000,000,000 bytes" On the Google site I found "1 megabyte = 1 048 576 bytes" It seems that there is no official standard for these names. However I would suggest that unless explicitly stated, one should assume Kilo = 2^10, Mega=2^20, Giga=2^30, Tera=2^40 for byte sizes. [snip] > > However I'm willing to be corrected. Just show me the proof. > > Is that proof enough? Yes. Thank you. -- Derek
16. Re: show drive space used?
- Posted by Wolf <wolfritz at KING.IGS.NET> Aug 29, 2003
- 420 views
> Yes. I found this on their site "Western Digital defines a megabyte (MB) as 1,000,000 bytes and a gigabyte (GB) as 1,000,000,000 bytes" > On the Google site I found "1 megabyte = 1 048 576 bytes" The 1,000,000 byte standard has been the *official* marketing scam of hard drive manufactuers for years, simply because it makes their product appear better to the naive consumer. In any case, Dan, it's unlikely that your data will ever match from one run to the next, since your swap file is usually dynamic, nevermind any other temporary files both the OS and other applications may always be creating in the background. ( %windir%\Applog, for example.. )
17. Re: show drive space used?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Aug 30, 2003
- 427 views
Wolf wrote: > > > > Yes. I found this on their site "Western Digital defines a megabyte (MB) > as 1,000,000 bytes and a gigabyte (GB) as 1,000,000,000 bytes" > > On the Google site I found "1 megabyte = 1 048 576 bytes" > > The 1,000,000 byte standard has been the *official* marketing scam of hard > drive manufactuers for years, simply because it makes their product appear > better to the naive consumer. That's what I figured :) > In any case, Dan, it's unlikely that your data will ever match from one run > to the next, since your swap file is usually dynamic, nevermind any other > temporary files both the OS and other applications may always be creating in > the background. ( %windir%\Applog, for example.. ) > Since the app is for seeing which directories have how much space used, it's not really terribly important that the *total* drive space used be absolutely accurate; it's just slightly irritating that I don't get (immediately) consistent results between the app & "properties". But what's still strange is that if I run the app and do "right-click, properties" both some number of times, then at some point they *will* agree with one another, & seem then to continue to do so thereafter for some while. But I'll probably take your advice (eventually) & ignore the "problem" :) Dan
18. Re: show drive space used?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Aug 30, 2003
- 416 views
Al wrote: <snip> > Ok here: > Properties shows 150 megabytes and the program shows > 155 megabytes and then you run scandisk. Now you > look at properties again and run the program again > and now they both show the same number of bytes > exactly. > Why are they showing the same after running scandisk? > > > Take care for now, > Al > Try just running your program & looking at properties some number of times (both), *without* running scandisk; I *think* you'll find that the results will mysteriously eventually coincide! They do for me, anyway. Dan Moyer