Karl Blessing
Programmer
I get an overflow error in this function<br>
<br>
Private Function CleanUp(ByVal sFol As String, sFile As String, nDirs As Integer, nFiles As Integer) As Long<br>
Dim tFld As Folder, tFil As File, FileName As String<br>
Set fld = fso.GetFolder(sFol)<br>
FileName = Dir(fso.BuildPath(fld.Path, sFile), vbNormal Or vbHidden Or vbSystem Or vbReadOnly)<br>
While Len(FileName) <> 0<br>
CleanUp = CleanUp + FileLen(fso.BuildPath(fld.Path, FileName))<br>
nFiles = nFiles + 1<br>
List1.AddItem fso.BuildPath(fld.Path, FileName) ' Load ListBox<br>
FileName = Dir() ' Get next file<br>
DoEvents<br>
Wend<br>
Label1 = "Searching " & vbCrLf & fld.Path & "..."<br>
nDirs = nDirs + 1<br>
If fld.SubFolders.Count > 0 Then<br>
For Each tFld In fld.SubFolders<br>
DoEvents<br>
If Left(tFld.Name, 1) = "_" Then List2.AddItem (tFld.Path)<br>
CleanUp = CleanUp + CleanUp(tFld.Path, sFile, nDirs, nFiles)<br>
Next<br>
End If<br>
End Function <p>Karl<br><a href=mailto:kb244@bellsouth.net>kb244@bellsouth.net</a><br><a href= </a><br>
<br>
Private Function CleanUp(ByVal sFol As String, sFile As String, nDirs As Integer, nFiles As Integer) As Long<br>
Dim tFld As Folder, tFil As File, FileName As String<br>
Set fld = fso.GetFolder(sFol)<br>
FileName = Dir(fso.BuildPath(fld.Path, sFile), vbNormal Or vbHidden Or vbSystem Or vbReadOnly)<br>
While Len(FileName) <> 0<br>
CleanUp = CleanUp + FileLen(fso.BuildPath(fld.Path, FileName))<br>
nFiles = nFiles + 1<br>
List1.AddItem fso.BuildPath(fld.Path, FileName) ' Load ListBox<br>
FileName = Dir() ' Get next file<br>
DoEvents<br>
Wend<br>
Label1 = "Searching " & vbCrLf & fld.Path & "..."<br>
nDirs = nDirs + 1<br>
If fld.SubFolders.Count > 0 Then<br>
For Each tFld In fld.SubFolders<br>
DoEvents<br>
If Left(tFld.Name, 1) = "_" Then List2.AddItem (tFld.Path)<br>
CleanUp = CleanUp + CleanUp(tFld.Path, sFile, nDirs, nFiles)<br>
Next<br>
End If<br>
End Function <p>Karl<br><a href=mailto:kb244@bellsouth.net>kb244@bellsouth.net</a><br><a href= </a><br>