I'm trying to determine the size of a directory including all subdirectories and files contained within. Does anyone know of another way to obtain a directory's size besides creating a Folder Object with FileSystemObject? Thanks for the help.
Any ideas on this one? Using the FileSystemObject works well during my testing, but it seems to fail randomly during runtime. I've looked into using the SHGetFileInfo API call, but haven't been successful in working that out. I've searched high and low for other solutions, but haven't found anything. Thanks in advance.
use adir and recurse through the directories. Adir will return the sizes of the files and the names of any subdirectories. It should not be too difficult to write code to add the file sizes and then look at each subdirectory etc.
I think that's the way I'm going to have to go. I've written code to do that, but was looking for a quicker way to determine a larger directory's size. Thanks for the help.
You can cut and paste the following.. and suitable create your function to return the total size..
**********************************************************
*** Instantiate the Filer object
oMyFiler = CREATEOBJECT('Filer.FileUtil')
oMyFiler.SearchPath = 'E:\WINNERS\CMP' && Search Directory
oMyFiler.SubFolder = 1 && includes sub folders
oMyFiler.Find(1) && cumulate sub-folders
LOCAL nSize
nSize = 0
FOR nFileCount = 1 TO oMyFiler.Files.Count
nSize=nSize+oMyFiler.Files.Item(nFileCount).Size && add the size
ENDFOR
? nSize, oMyFiler.Files.Count && display size and count
***********************************************************
Hope this helps you ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
LET KNOW IF THIS HELPED. ENOUGH EXPERTS ARE HERE TO HELP YOU OUT! BEST OF LUCK
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.