PDA

Click to See Complete Forum and Search --> : How to get Folder's size?


chalenge
Jan 16th, 2000, 10:23 AM
How to get Folder's size?
Not disk free space or not file size it is just folder size like a right click of properties.

Thanks

chrisjk
Jan 16th, 2000, 11:28 AM
It's a bit of a slow way of doing it, but you could simply get the size of each file in the directory and add them up...

Use a loop to gather size of each file in the directory (look up the Dir() function in Help and go to http://www.vb-world.net/files/fileinfo/ to find out about getting file size), then simply add each file size to a variable...

Hope that helps

regards,

------------------
- Chris
chris.kilhams@btinternet.com
If it ain't broke - don't fix it :)

mcleran
Jan 16th, 2000, 09:15 PM
Use the Folder object. Set a reference to Microsoft Scriptime Runtime and then instantie a folder object and a file system object.

Dim fso As FileSystemObject
Dim fldr As Folder

Set fso = New FileSystemObject

Set fldr = fso.GetFolder(path to folder)

?fldr.Size