Wednesday, August 02, 2006

Determining the Size of a Directory on the Device

A common question with the Srego CE ToolPack ActiveX control is how to find the size of a directory on the device. There is not a single method to determine this value, but it is not very difficult to determine using the following code:


Dim filelist As Variant


Dim typelist As Variant

Dim count As Variant

If SregoCETPx1.GetFileListEx("\storage card\my documents\*.*", _

filelist, typelist, count, "/S") Then

Dim total As Double

total = 0

For i = 0 To count - 1

If typelist(i) = 1 Then

total = total + _
SregoCETPx1.GetFileSize(filelist(i), 0)

End If

Next

Debug.Print "Total: " + Str(total)

End If

No comments: