PDA

View Full Version : Calculate folder size


gridrunner
08-25-2006, 04:37 PM
Hi,
I use the File.copy with the wildcat *.* command to copy folders with files form a stand alone application to hard disk. Is there a way to get the folder size?

pww
08-26-2006, 03:46 AM
check the help file info (examples) about the File.GetSize action - the last example seems to be what you need.

gridrunner
08-26-2006, 09:42 AM
ok - i have to browse through all the files and add the file size.

csd214
08-27-2006, 08:57 AM
To all of you who want to calculate the folder size, please read this post (http://www.indigorose.com/forums/showthread.php?t=5884) in the AMS50 Forum. It should be helpful!

pww
08-27-2006, 02:58 PM
As I see the code in this post also enumerates all the files, gets the size of each and adds it to the sum.

BTW it just can't be otherwise, afaik there is no even Windows API call that will return the size of a folder fast, without looping through all the files.
For a folder with many files inside, getting the size takes time.

I don't know for what reason you may need to calculate a folder size.
If it's for a folder with files included in your installer, better calculate it before making the setup and include in the setup the already computed size.

Intrigued
08-27-2006, 03:18 PM
Tip: AutoIT 3 has a function for this need.

Check it out here:
http://www.autoitscript.com/autoit3/docs/functions/DirGetSize.htm