Sign in to follow this  
Followers 0
robmason

drivespacefree / drivespacetotal discrepancy

4 posts in this topic

The following script yields some wide discrepancy than what the OS is reporting:

$free = driveSpaceFree("C:")

$total= driveSpaceTotal("C:")

msgbox(4096,@COMPUTERNAME,"total=" & $total & " free=" & $free)

See the attachement for output and what properties of my C: drive looks like. I'm wondering why the vast discrepancy? I understand that they come across in MB, but the total is way off.

This is running on Windows XP SP2 (32b)

Thanks

Rob

post-33765-1206384865_thumb.jpg

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Doing this:

$free = driveSpaceFree("C:") / 1024
$total= driveSpaceTotal("C:") / 1024
msgbox(4096,@COMPUTERNAME,"total=" & $total & " free=" & $free)

I didn't have a huge discrepancy. Just a few decimal points and thats due to the dropping the last few decimal places.

DriveSpaceFree and DriveSpaceTotal returns in Megabytes if you just devide that by 1024 that will give you how many gigs are free.

post-33596-1206385406_thumb.jpg

Edited by MattWise

[sub]Quantum mechanics: The dreams stuff is made of[/sub]

Share this post


Link to post
Share on other sites

Usually there are going to be differences because the page file and temp folder change size dynamically.

I get discrepencies if I check the drive properties and run my script a few seconds later. If I launch my script and hit the properties very quickly the numbers match just fine.

Share this post


Link to post
Share on other sites

Excellent guys - that makes sense now.

Thanks

Rob

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0