Jump to content
Sign in to follow this  
Valuater

DirGetSize() problem

Recommended Posts

Valuater

This little script seems to take forever on some computers.

$size = DirGetSize(@HomeDrive)
Msgbox(0,"","Size(MegaBytes):" & Round($size / 1024 / 1024))

What my desire is, to clean a computer then calculate the amount of room recovered on the hard drive when completed. So, I use this twice which takes twice as long.

Maybe there is a faster way.... check free space... or... ???

Thx

Valuater

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
Valuater

Thats ok, ..... I got it

Two as a mater of fact.

$objWMIService = ObjGet("winmgmts:")
$objLogicalDisk = $objWMIService.Get("Win32_LogicalDisk.DeviceID='C:'")
MsgBox(0, 0, Round($objLogicalDisk.FreeSpace / 1024 / 1024 / 1024, 2) & " Gig   ")


$fso = ObjCreate("Scripting.FileSystemObject")
$d = $fso.GetDrive(@HomeDrive)
MsgBox(0, 0, Round($d.FreeSpace / 1024 / 1024 / 1024, 2) & " Gig   ")

thx

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
czardas

Interesting. It's beyond me, but something did occur to me. If the data removed was much smaller than the amount of data remaining on the drive, then adding up the amount of removed data might be faster than re-examining the whole drive. If that makes any sense. I have no idea.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.