1. [WIN] drive space used != total file space used; whynot?

On Win98 2nd ed, if I right-click on all top-level directories/folders on a
drive, select "properties", and record the number of bytes USED for each
directory(not just the sum of the size of the files in them), and then sum
all directories, and then do the same "properties" query for the DRIVE
itself, the sums for all directories does NOT equal the "used space" in
bytes for the drive.  Can anyone tell me why?

I was making a utility to show all directories in descending order of space
used on the drive for each, and it finally works, except the sum of the
(correctly reported) sizes of all the directories doesn't equal the
"properties" reported size of the drive itself.

Dan Moyer

new topic     » topic index » view message » categorize

2. Re: [WIN] drive space used != total file space used; whynot?

----- Original Message ----- 
From: "Dan Moyer" <DANIELMOYER at prodigy.net>


> 
> On Win98 2nd ed, if I right-click on all top-level directories/folders on a
> drive, select "properties", and record the number of bytes USED for each
> directory(not just the sum of the size of the files in them), and then sum
> all directories, and then do the same "properties" query for the DRIVE
> itself, the sums for all directories does NOT equal the "used space" in
> bytes for the drive.  Can anyone tell me why?
> 
> I was making a utility to show all directories in descending order of space
> used on the drive for each, and it finally works, except the sum of the
> (correctly reported) sizes of all the directories doesn't equal the
> "properties" reported size of the drive itself.
> 
> Dan Moyer


Hey Dan,

On Windows 95 OSR2 and later you can use this to check the drive
space.

global function GetDiskFreeSpace(sequence drive)
    atom lpDirectoryName,lpFreeBytesAvailable,lpTotalNumberOfBytes,
  lpTotalNumberOfFreeBytes,bool
    sequence info

    lpDirectoryName=allocate_string(drive)
    lpFreeBytesAvailable=allocate(8)
    lpTotalNumberOfBytes =allocate(8)
    lpTotalNumberOfFreeBytes=allocate(8)

    bool=c_func(xGetDiskFreeSpaceEx,
  {lpDirectoryName,
  lpFreeBytesAvailable,
  lpTotalNumberOfBytes ,
  lpTotalNumberOfFreeBytes})

    info={
   peek4u(lpFreeBytesAvailable+4)*power(2,32)+peek4u(lpFreeBytesAvailable),
   peek4u(lpTotalNumberOfBytes +4)*power(2,32)+peek4u(lpTotalNumberOfBytes ),
peek4u(lpTotalNumberOfFreeBytes+4)*power(2,32)+peek4u(lpTotalNumberOfFreeBytes)
  }

    free(lpDirectoryName)
    free(lpFreeBytesAvailable)
    free(lpTotalNumberOfBytes )
    free(lpTotalNumberOfFreeBytes)
    
    return info
end function

or on Window 95 OSR-2 and below you can use this which doesnt correctly return
volume sizes that are greater than 2GB

function GetDiskFreeSpace(sequence drive)
    atom lpPathName,lpSectorsPerCluster,lpBytesPerSector,
  lpNumberOfFreeClusters,lpTotalNumberOfClusters,bool
    sequence info

    lpPathName=allocate_string2(drive)
    lpSectorsPerCluster=allocate(4)
    lpBytesPerSector=allocate(4)
    lpNumberOfFreeClusters=allocate(4)
    lpTotalNumberOfClusters=allocate(4)

    bool=c_func(hGetDiskFreeSpace,
  {lpPathName,
  lpSectorsPerCluster,
  lpBytesPerSector,
  lpNumberOfFreeClusters,
  lpTotalNumberOfClusters})

    info={
   bool,
   peek4u(lpSectorsPerCluster),
   peek4u(lpBytesPerSector),
   peek4u(lpNumberOfFreeClusters),
   peek4u(lpTotalNumberOfClusters)
  }

    --warning:
    --this function shows bytes up to 2gig drive limit,
    --but thats good enough for most aps needing to know
    --if there is free space available.

    free(lpPathName)
    free(lpSectorsPerCluster)
    free(lpBytesPerSector)
    free(lpNumberOfFreeClusters)
    free(lpTotalNumberOfClusters)
    return info
end function

I would use the first one because I dont think many people are still
using Win95 OSR-2 or lower.

Hope this help's.

Euman
euman at bellsouth.net

new topic     » goto parent     » topic index » view message » categorize

3. Re: [WIN] drive space used != total file space used; whynot?

Euman,

Thanks, but that's not what I need.  I'm not looking for FREE space on a
drive, I'm trying to display the space USED by all directories on a drive.
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

----- Original Message -----
From: <euman at bellsouth.net>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, February 09, 2002 10:17 AM
Subject: Re: [WIN] drive space used != total file space used; whynot?


>
> ----- Original Message -----
> From: "Dan Moyer" <DANIELMOYER at prodigy.net>
>
>
> > On Win98 2nd ed, if I right-click on all top-level directories/folders
on a
> > drive, select "properties", and record the number of bytes USED for each
> > directory(not just the sum of the size of the files in them), and then
sum
> > all directories, and then do the same "properties" query for the DRIVE
> > itself, the sums for all directories does NOT equal the "used space" in
> > bytes for the drive.  Can anyone tell me why?
> >
> > I was making a utility to show all directories in descending order of
space
> > used on the drive for each, and it finally works, except the sum of the
> > (correctly reported) sizes of all the directories doesn't equal the
> > "properties" reported size of the drive itself.
> >
> > Dan Moyer
>
>
> Hey Dan,
>
> On Windows 95 OSR2 and later you can use this to check the drive
> space.
>
> global function GetDiskFreeSpace(sequence drive)
>     atom lpDirectoryName,lpFreeBytesAvailable,lpTotalNumberOfBytes,
>   lpTotalNumberOfFreeBytes,bool
>     sequence info
>
>     lpDirectoryName=allocate_string(drive)
>     lpFreeBytesAvailable=allocate(8)
>     lpTotalNumberOfBytes =allocate(8)
>     lpTotalNumberOfFreeBytes=allocate(8)
>
>     bool=c_func(xGetDiskFreeSpaceEx,
>   {lpDirectoryName,
>   lpFreeBytesAvailable,
>   lpTotalNumberOfBytes ,
>   lpTotalNumberOfFreeBytes})
>
>     info={
>
peek4u(lpFreeBytesAvailable+4)*power(2,32)+peek4u(lpFreeBytesAvailable),
>    peek4u(lpTotalNumberOfBytes
+4)*power(2,32)+peek4u(lpTotalNumberOfBytes ),
>
peek4u(lpTotalNumberOfFreeBytes+4)*power(2,32)+peek4u(lpTotalNumberOfFreeByt
es)
>   }
>
>     free(lpDirectoryName)
>     free(lpFreeBytesAvailable)
>     free(lpTotalNumberOfBytes )
>     free(lpTotalNumberOfFreeBytes)
>
>     return info
> end function
>
> or on Window 95 OSR-2 and below you can use this which doesnt correctly
return
> volume sizes that are greater than 2GB
>
> function GetDiskFreeSpace(sequence drive)
>     atom lpPathName,lpSectorsPerCluster,lpBytesPerSector,
>   lpNumberOfFreeClusters,lpTotalNumberOfClusters,bool
>     sequence info
>
>     lpPathName=allocate_string2(drive)
>     lpSectorsPerCluster=allocate(4)
>     lpBytesPerSector=allocate(4)
>     lpNumberOfFreeClusters=allocate(4)
>     lpTotalNumberOfClusters=allocate(4)
>
>     bool=c_func(hGetDiskFreeSpace,
>   {lpPathName,
>   lpSectorsPerCluster,
>   lpBytesPerSector,
>   lpNumberOfFreeClusters,
>   lpTotalNumberOfClusters})
>
>     info={
>    bool,
>    peek4u(lpSectorsPerCluster),
>    peek4u(lpBytesPerSector),
>    peek4u(lpNumberOfFreeClusters),
>    peek4u(lpTotalNumberOfClusters)
>   }
>
>     --warning:
>     --this function shows bytes up to 2gig drive limit,
>     --but thats good enough for most aps needing to know
>     --if there is free space available.
>
>     free(lpPathName)
>     free(lpSectorsPerCluster)
>     free(lpBytesPerSector)
>     free(lpNumberOfFreeClusters)
>     free(lpTotalNumberOfClusters)
>     return info
> end function
>
> I would use the first one because I dont think many people are still
> using Win95 OSR-2 or lower.
>
> Hope this help's.
>
> Euman
> euman at bellsouth.net
>
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: [WIN] drive space used != total file space used; whynot?

----- Original Message -----
From: "Dan Moyer" <DANIELMOYER at prodigy.net>
To: "EUforum" <EUforum at topica.com>
Subject: Re: [WIN] drive space used != total file space used; whynot?


lesson that you cannot believe everything you see, another is, reality is a
matter of perspective....both apply to how Windows properties "sees" disk
comsumption.  Windows XP, for instance, shows a 151 byte file located on
drive c:\  in two ways when I view it in properties.  1). it says the file
is 151bytes in size ( .151K)  2).  it also states that this one file is
taking up 4096 bytes (4K) of drive space.  Is Windows insane and doesn't
know what it is saying?  No, both are true becuase  the  cluster size is 4K
and  the whole cluster is flagged as used.  Should for some reason Defrag
(or some other wonderful optimization utility) not have been run for awhile
these unused portions of clusters add up and Windows Properties can wreak
havoc on the senses.  My suggestion would be to ignore windows properties
and go with a non-comparitive approach.
>
> Euman,
>
> Thanks, but that's not what I need.  I'm not looking for FREE space on a
> drive, I'm trying to display the space USED by all directories on a drive.
> 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
>
> ----- Original Message -----
> From: <euman at bellsouth.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Saturday, February 09, 2002 10:17 AM
> Subject: Re: [WIN] drive space used != total file space used; whynot?
>
>
> > ----- Original Message -----
> > From: "Dan Moyer" <DANIELMOYER at prodigy.net>
> >
> >
> > > On Win98 2nd ed, if I right-click on all top-level directories/folders
> on a
> > > drive, select "properties", and record the number of bytes USED for
each
> > > directory(not just the sum of the size of the files in them), and then
> sum
> > > all directories, and then do the same "properties" query for the DRIVE
> > > itself, the sums for all directories does NOT equal the "used space"
in
> > > bytes for the drive.  Can anyone tell me why?
> > >
> > > I was making a utility to show all directories in descending order of
> space
> > > used on the drive for each, and it finally works, except the sum of
the
> > > (correctly reported) sizes of all the directories doesn't equal the
> > > "properties" reported size of the drive itself.
> > >
> > > Dan Moyer
> >
> >
> > Hey Dan,
> >
> > On Windows 95 OSR2 and later you can use this to check the drive
> > space.
> >
> > global function GetDiskFreeSpace(sequence drive)
> >     atom lpDirectoryName,lpFreeBytesAvailable,lpTotalNumberOfBytes,
> >   lpTotalNumberOfFreeBytes,bool
> >     sequence info
> >
> >     lpDirectoryName=allocate_string(drive)
> >     lpFreeBytesAvailable=allocate(8)
> >     lpTotalNumberOfBytes =allocate(8)
> >     lpTotalNumberOfFreeBytes=allocate(8)
> >
> >     bool=c_func(xGetDiskFreeSpaceEx,
> >   {lpDirectoryName,
> >   lpFreeBytesAvailable,
> >   lpTotalNumberOfBytes ,
> >   lpTotalNumberOfFreeBytes})
> >
> >     info={
> >
> peek4u(lpFreeBytesAvailable+4)*power(2,32)+peek4u(lpFreeBytesAvailable),
> >    peek4u(lpTotalNumberOfBytes
> +4)*power(2,32)+peek4u(lpTotalNumberOfBytes ),
> >
>
peek4u(lpTotalNumberOfFreeBytes+4)*power(2,32)+peek4u(lpTotalNumberOfFreeByt
> es)
> >   }
> >
> >     free(lpDirectoryName)
> >     free(lpFreeBytesAvailable)
> >     free(lpTotalNumberOfBytes )
> >     free(lpTotalNumberOfFreeBytes)
> >
> >     return info
> > end function
> >
> > or on Window 95 OSR-2 and below you can use this which doesnt correctly
> return
> > volume sizes that are greater than 2GB
> >
> > function GetDiskFreeSpace(sequence drive)
> >     atom lpPathName,lpSectorsPerCluster,lpBytesPerSector,
> >   lpNumberOfFreeClusters,lpTotalNumberOfClusters,bool
> >     sequence info
> >
> >     lpPathName=allocate_string2(drive)
> >     lpSectorsPerCluster=allocate(4)
> >     lpBytesPerSector=allocate(4)
> >     lpNumberOfFreeClusters=allocate(4)
> >     lpTotalNumberOfClusters=allocate(4)
> >
> >     bool=c_func(hGetDiskFreeSpace,
> >   {lpPathName,
> >   lpSectorsPerCluster,
> >   lpBytesPerSector,
> >   lpNumberOfFreeClusters,
> >   lpTotalNumberOfClusters})
> >
> >     info={
> >    bool,
> >    peek4u(lpSectorsPerCluster),
> >    peek4u(lpBytesPerSector),
> >    peek4u(lpNumberOfFreeClusters),
> >    peek4u(lpTotalNumberOfClusters)
> >   }
> >
> >     --warning:
> >     --this function shows bytes up to 2gig drive limit,
> >     --but thats good enough for most aps needing to know
> >     --if there is free space available.
> >
> >     free(lpPathName)
> >     free(lpSectorsPerCluster)
> >     free(lpBytesPerSector)
> >     free(lpNumberOfFreeClusters)
> >     free(lpTotalNumberOfClusters)
> >     return info
> > end function
> >
> > I would use the first one because I dont think many people are still
> > using Win95 OSR-2 or lower.
> >
> > Hope this help's.
> >
> > Euman
> > euman at bellsouth.net
> >
> >
>
>
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: [WIN] drive space used != total file space used; whynot?

On 9 Feb 2002, at 16:53, Dan Moyer wrote:

> 
> Euman,
> 
> Thanks, but that's not what I need.  I'm not looking for FREE space on a
> drive, I'm trying to display the space USED by all directories on a drive.
> 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?

How about the space used by the file names themselves? Remember too, 
the long file names (over 8.3) take up more space. And the directory and 
subdirectory space the filenames live in with their pointers to the files 
themselves (the FAT, 2 or 3 of them, depending). And round everything up to 
the nearest cluster increment.

Kat

new topic     » goto parent     » topic index » view message » categorize

6. Re: [WIN] drive space used != total file space used; whynot?

Vern,

Ok, I understood the difference between what the size of an individual file
is and the amount of space taken up on a drive by that file due to unit
cluster size, and have accommodated that clumsily (still haven't found a way
to programmatically discern cluster size);  I was using the "properties"
comparison originally to see if my code was correctly handling cluster size
increments and summing individual directories size used correctly, so I
thought to do the same for the drive as a whole, but I'll probably take your
advice and ignore it.  Thanks.

Dan

----- Original Message -----
From: <vern at lvp.eastlink.ca>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, February 09, 2002 6:06 PM
Subject: Re: [WIN] drive space used != total file space used; whynot?


>
>
> ----- Original Message -----
> From: "Dan Moyer" <DANIELMOYER at prodigy.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Saturday, February 09, 2002 8:53 PM
> Subject: Re: [WIN] drive space used != total file space used; whynot?
>
>
> lesson that you cannot believe everything you see, another is, reality is
a
> matter of perspective....both apply to how Windows properties "sees" disk
> comsumption.  Windows XP, for instance, shows a 151 byte file located on
> drive c:\  in two ways when I view it in properties.  1). it says the file
> is 151bytes in size ( .151K)  2).  it also states that this one file is
> taking up 4096 bytes (4K) of drive space.  Is Windows insane and doesn't
> know what it is saying?  No, both are true becuase  the  cluster size is
4K
> and  the whole cluster is flagged as used.  Should for some reason Defrag
> (or some other wonderful optimization utility) not have been run for
awhile
> these unused portions of clusters add up and Windows Properties can wreak
> havoc on the senses.  My suggestion would be to ignore windows properties
> and go with a non-comparitive approach.
> >
> > Euman,
> >
> > Thanks, but that's not what I need.  I'm not looking for FREE space on a
> > drive, I'm trying to display the space USED by all directories on a
drive.
> > 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
> >

new topic     » goto parent     » topic index » view message » categorize

7. Re: [WIN] drive space used != total file space used; whynot?

Kat,

Space taken up for filenames makes sense, maybe that's it.  I did round up
to nearest cluster increment, that's what I was checking via "properties",
to see what space it said was actually used for each directory's contents,
although I had to force feed cluster size because I still can't get a valid
cluster size programmatically.

On a nearly empty 10gig drive, "properties" reports about 2 million LESS
bytes used than summation of all files; on a nearly full 3gig drive,
"properties" reports about 12 million MORE bytes used than summation of all
files.  sigh.

I guess for my purposes I'll just ignore the drive space used disparity as
long as I'm getting apparently "accurate" reports for space used per
directory.

Dan

----- Original Message -----
From: "Kat" <gertie at PELL.NET>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, February 09, 2002 6:15 PM
Subject: Re: [WIN] drive space used != total file space used; whynot?


>
> On 9 Feb 2002, at 16:53, Dan Moyer wrote:
>
> >
> > Euman,
> >
> > Thanks, but that's not what I need.  I'm not looking for FREE space on a
> > drive, I'm trying to display the space USED by all directories on a
drive.
> > 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?
>
> How about the space used by the file names themselves? Remember too,
> the long file names (over 8.3) take up more space. And the directory and
> subdirectory space the filenames live in with their pointers to the files
> themselves (the FAT, 2 or 3 of them, depending). And round everything up
to
> the nearest cluster increment.
>
> Kat
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

8. Re: [WIN] drive space used != total file space used; whynot?

On 9 Feb 2002, at 22:06, vern at lvp.eastlink.ca wrote:

> 
> 
> ----- Original Message -----
> From: "Dan Moyer" <DANIELMOYER at prodigy.net>
> To: "EUforum" <EUforum at topica.com>
> Sent: Saturday, February 09, 2002 8:53 PM
> Subject: Re: [WIN] drive space used != total file space used; whynot?
> 
> 
> lesson that you cannot believe everything you see, another is, reality is a
> matter of perspective....both apply to how Windows properties "sees" disk
> comsumption.  Windows XP, for instance, shows a 151 byte file located on drive
> c:\  in two ways when I view it in properties.  1). it says the file is
> 151bytes
> in size ( .151K)  2).  it also states that this one file is taking up 4096
> bytes
> (4K) of drive space.  Is Windows insane and doesn't know what it is saying? 
> No,
> both are true becuase  the  cluster size is 4K and  the whole cluster is
> flagged
> as used.  Should for some reason Defrag (or some other wonderful optimization
> utility) not have been run for awhile these unused portions of clusters add up
> and Windows Properties can wreak havoc on the senses. 

Defrag doesn't use the unused 3945 bytes in the 4096 cluster used by your 
151byte file. What is does is move the contents of all the used clusters to 
the "front" of the disk, and make sure all the clusters used by each file are in
order and next to each other, in the correct sequential order,, and not stored 
in one cluster here, the next cluster over there, and the next cluster back 
somewhere else, you know, in a fragmented manner.

See, in the other thread, shortening a file, if the file uses 2 clusters, and 
there is another file at the end of it, and the first file is shortened to one 
cluster, dos/windoze may use that now-unused cluster to store a portion of a 
3rd file. When it comes time to read that 3rd file, the drive hasto seek all
over
the disk to get all the pieces stored in places like this, consuming more time 
than it should. The modern OSs after dos make this a real problem with their 
"virtual memory" being on harddrive.

Kat

new topic     » goto parent     » topic index » view message » categorize

9. Re: [WIN] drive space used != total file space used; whynot?

On Sat, 9 Feb 2002 16:53:33 -0800, you wrote:

>the "properties" says there's more space used up on the drive than the
>summing of the directories says.

I just did a quick test on my D: drive and found it was out by
3,774,501 bytes. (Taking into account files in the root directory and
all hidden files blink If that figure looks familiar maybe it's a FAT
table or something... 

Pete

new topic     » goto parent     » topic index » view message » categorize

10. Re: [WIN] drive space used != total file space used; whynot?

On Saturday 09 February 2002 07:53 pm, Dan Moyer wrote:

> Thanks, but that's not what I need.  I'm not looking for FREE space on a
> drive, I'm trying to display the space USED by all directories on a drive.
> 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?

How *much* difference is there? A few bytes, or a few mega?
That might help in finding the answer.

Regards,
Irv

new topic     » goto parent     » topic index » view message » categorize

11. 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

new topic     » goto parent     » topic index » view message » categorize

12. Re: [WIN] drive space used != total file space used; whynot?

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
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

13. Re: [WIN] drive space used != total file space used; whynot?

Irv,

You're right, that could be important!  I mentioned the size differences s
once, but I know that posts don't get to everyone at the same time from
topica.

On a nearly empty 10gig drive, "properties" reports about 2 million LESS
bytes used than summation of all files; on a nearly full 3gig drive,
"properties" reports about 12 million MORE bytes used than summation of all
files.  sigh.

I guess for my purposes I'll just ignore the drive space used disparity as
long as I'm getting apparently "accurate" reports for space used per
directory.

Dan



----- Original Message -----
From: "Irv Mullins" <irvm at ellijay.com>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, February 10, 2002 5:36 AM
Subject: Re: [WIN] drive space used != total file space used; whynot?


>
> On Saturday 09 February 2002 07:53 pm, Dan Moyer wrote:
>
> > Thanks, but that's not what I need.  I'm not looking for FREE space on a
> > drive, I'm trying to display the space USED by all directories on a
drive.
> > 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?
>
> How *much* difference is there? A few bytes, or a few mega?
> That might help in finding the answer.
>
> Regards,
> Irv
>

new topic     » goto parent     » topic index » view message » categorize

14. Re: [WIN] drive space used != total file space used; whynot?

Pete,

Yeah, that's the right order of magnitude of the discrepancy.  Dunno if FAT
table would be that big, maybe.  I think Bernie might have it with the
"swap" file idea.  Plus maybe file & directory filenames making some
difference too, as Kat suggested.

I'll probably just ignore the discrepancy.

Dan


----- Original Message -----
From: <petelomax at blueyonder.co.uk>
To: "EUforum" <EUforum at topica.com>
Sent: Sunday, February 10, 2002 3:02 AM
Subject: Re: [WIN] drive space used != total file space used; whynot?




On Sat, 9 Feb 2002 16:53:33 -0800, you wrote:

>the "properties" says there's more space used up on the drive than the
>summing of the directories says.

I just did a quick test on my D: drive and found it was out by
3,774,501 bytes. (Taking into account files in the root directory and
all hidden files blink If that figure looks familiar maybe it's a FAT
table or something...

Pete

new topic     » goto parent     » topic index » view message » categorize

15. Re: [WIN] drive space used != total file space used; whynot?

Bernie,

You're right, I *did* forget about the swap file!
But I'm not sure that's it, because "help" says about the swap file:
"Whenever possible, let Windows manage your virtual memory. Windows chooses
the default setting based on the amount of free hard-disk space. The swap
file then shrinks and grows dynamically based on actual memory usage."

Not sure if that means the space used for swap file would be included in
"properties" return of drive space used or not.

 But I'll probably ignore the discrepancy since my directory sizes are
accurate, and that's what I was trying to get.  Drive size was just a cherry
on top, never expected it to be a problem.

Thanks.

Dan

----- Original Message -----
From: "Bernie Ryan" <xotron at localnet.com>
To: "EUforum" <EUforum at topica.com>
Sent: Saturday, February 09, 2002 8:17 PM
Subject: RE: [WIN] drive space used != total file space used; whynot?


>
>
> Dan Moyer wrote:
> > On Win98 2nd ed, if I right-click on all top-level directories/folders
> > on a
> > drive, select "properties", and record the number of bytes USED for each
> > directory(not just the sum of the size of the files in them), and then
> > sum
> > all directories, and then do the same "properties" query for the DRIVE
> > itself, the sums for all directories does NOT equal the "used space" in
> > bytes for the drive.  Can anyone tell me why?
> >
> > I was making a utility to show all directories in descending order of
> > space
> > used on the drive for each, and it finally works, except the sum of the
> > (correctly reported) sizes of all the directories doesn't equal the
> > "properties" reported size of the drive itself.
> >
>
> Dan:
>    Maybe you forgot about the windows SWAP file which
>    probably is not counted in your directory byte count
>    but shows up as harddrive bytes used.
> Bernie
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu