cypher175 Posted November 11, 2008 Posted November 11, 2008 I see there are functions to get Either "DriveSpaceTotal" & "DriveSpaceFree" but is there a Function to get the "DriveSpaceUsed"..?? To return the Amount of MB a Drive is currently using..?? Or would I have to do some Function math to return this "DriveSpaceUsed" Value..?? Something like: $Total = DriveSpaceTotal( "c:\" ) $Free = DriveSpaceFree( "c:\" ) $Used = $Total - $Free MsgBox(0, "", "C:\ Is Using " & $Used & " MB")
monoceres Posted November 11, 2008 Posted November 11, 2008 No need for another function since it's so easy (like you already figured out) to calculate this value. Broken link? PM me and I'll send you the file!
cypher175 Posted November 11, 2008 Author Posted November 11, 2008 So there is no already existing AutoIt Function then for "DriveSpaceUsed"..?? If they already have the other 2 functions why not include the 3rd For "DriveSpaceUsed" so you don't have to use more code to determine this "DriveSpaceUsed" Value..??
monoceres Posted November 11, 2008 Posted November 11, 2008 So there is no already existing AutoIt Function then for "DriveSpaceUsed"..??If they already have the other 2 functions why not include the 3rd For "DriveSpaceUsed" so you don't have to use more code to determine this "DriveSpaceUsed" Value..??Because it's completely unnecessary, if all function were added that was just a simple combination of two other function the function list would skyrocket. Broken link? PM me and I'll send you the file!
ResNullius Posted November 11, 2008 Posted November 11, 2008 Would a dirgetsize work?Yes, but takes a lonnnnnnnnng time on a drive with lots of files.
Diana (Cda) Posted October 14, 2009 Posted October 14, 2009 Yes, but takes a lonnnnnnnnng time on a drive with lots of files. Well, the drive that I'm trying to use this on is small. It's an email folder and I just would like easy way to monitor how much email is on in terms of total size. However, this is the only message that came up in a search, so hoping it's okay to add to this old thread. I modified another script I have, a disk free one, with the DirGetSize option and I got this: $var1 = DirGetSize(@ScriptDir) $SpaceUsed = Round($var1/1024/1000) MsgBox(64,"Used space ...","The used space in this root folder totals at or below:" & @CRLF & _ "---------------------------------------------------------------- " & @CRLF & @CRLF & _ $SpaceUsed & " MB")I get an end result here of 19 MB. But I was wondering if this was the correct way to show the total size being used up by total folder contents? Thanks.
Diana (Cda) Posted October 14, 2009 Posted October 14, 2009 (edited) Worked on the script some more:;---------------------------------------------------------------- Local $sFile = @ScriptDir ; Drive letter - Example returns "C" Local $sDrive = StringRegExpReplace($sFile, ":.*$", "") ;---------------------------------------------------------------- $var1 = DirGetSize(@ScriptDir) $SpaceUsed = Round($var1/1024/1000, 2) ;--------------------------------------- $var2 = DriveSpaceFree($Folder1LevelUp) $SpaceFree = Round($var2/1024, 2) ;--------------------------------------- MsgBox(64,"Used space ...","The used space in this root folder totals:" & @CRLF & _ "---------------------------------------------------------------------" & @CRLF & @CRLF & _ $SpaceUsed & " MB." & @CRLF & @CRLF & _ "---------------------------------------------------------------------" & @CRLF & @CRLF & _ $SpaceFree & " GB is/are still free to use for the entire [" & $sDrive & ":\] drive. ") Exit ; finishedThis seems to do the job but it fails in one area, I've put MB and GB in because that's what I happen to have. It would be neat for AI to determine the size in question. But this seems to work fine, so I'll just have to remember to modify this script if sizes I'm dealing with change from MB to GB at some point down the road or if I ever were dealing with a flash drive where the total size might just be MB instead of GB in any given folder. Edited October 14, 2009 by Diana (Cda)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now