Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate space usage for a folder and all subfolders

Status
Not open for further replies.

freavis

MIS
Feb 5, 2002
19
0
0
US
I am trying to calculate the size of a folder using a vbscript. I have already got a script that works using the .size property. But if you look at the propertys of a folder you will see a "Size:" and a "Size on Disk:". Does anyone know how to get the Size on Disk back? I'm assuming that you will have to make caculations for how many files are in the subfolders since it is using the block size for getting this number. I have not been able to find a way to do this yet, but I know there must be a way since it shows up in the properties of the folder.
Thanks in advance.
 
This can be done several ways. VBScript/WSH and WMI.

VBScript/WSH See:

Check Devguru.com

Look at Filesystemobject and Folders collection (has a property of size that reports used in bytes.)

Sample code scan for: FolderProperties.vbs


Also try searching Google for: "wsh folder collection size" or some combination like that.

Hope this helps.
DougCranston
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top