I'm looking for an easy way to get the size of a directory. Thought there might be something like a GetDirectorySize() function, but there seems to be none.
I stumbled accross the p_TraverseDir() example on the "DirectoryItems" page and modified it like this:
Code: Select all
Function p_GetDirectorySize(d$, recursive)
Local ret = 0
For s$, t In DirectoryItems(d$)
If t.type = #DOSTYPE_FILE
ret = ret + t.size
ElseIf recursive
ret = ret + p_GetDirectorySize(FullPath(d$, s$), recursive)
EndIf
Next
Return(ret)
EndFunction
Maybe such a GetDirectorySize() function would be a nice addition to the DOS library for Hollywood 9.1...
Cheers, Michael