Sign in to follow this  
Followers 0
am632

Need help getting free space on drive

8 posts in this topic

Hi,

I have an imputbox which when you click the browse buton you can choose a directory - then when you click ok, the inputbox is automatically updated with the directory you chose which works fine, but id like to display a lable of the freespace of that folder in MB.

I think i need to do this using drivespacefree but im not sure exactly what i need to do, can anyone help please?

thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$folder = FileSelectFolder("Choose a folder.", "")

MsgBox(0,"",$folder)

$space = DriveSpaceFree( StringLeft($folder,3) )

MsgBox(4096, "Free space on " & StringLeft($folder,3) , $space & "MB")

Edited code

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi, thanks for the reply - works gr8. Just 1 question, how do I round it so there isnt a long decimal?

thanks

EDIT:

I changed the line of code to read

$SPACEDETECTEDRESULT = GUICtrlCreateLabel($FREESPACEONDRIVE /1024 & " GB", 220, 400, 170, 22)
which works and displays the correct number 134 in my case, but there are loads of numbers behind the decimal point. how can i get rid of them?

thanks

Edited by am632

Share this post


Link to post
Share on other sites

Thanks a lot, I appreciate your help

Share this post


Link to post
Share on other sites

If you want there to be decimal places, use Round($FREESPACEONDRIVE /1024, 2) ; 2 meaning 2 decimal places.

What would be the final full code?

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