Hi, modified Mahares's code a bit to allow for auto sub-folder deletes as well.
Sub CheckPath (Path As String) As String
If Path.EndsWith("/") Then
Return Path
Else
Return Path & "/"
End If
End Sub
Sub ClearPath (Path As String, RemovePath As Boolean)
Dim fileList As List
fileList.initialize
fileList = File.ListFiles(Path)
For i=fileList.Size-1 To 0 Step -1
Dim fileName As String = fileList.Get(i)
If File.IsDirectory(Path, fileName) Then ClearPath(CheckPath (Path) & fileName, True) ' *** Clear contained directory 1'st ...
File.Delete(Path, fileName)
Next
' *** Remove folder if specified ...
If RemovePath Then
If Path.EndsWith("/") Then Path = Path.SubString2(0, Path.Length-1)
Dim p As Int = Path.LastIndexOf("/")
Dim dName As String = Path.SubString(p + 1)
Path = Path.SubString2(0, p + 1)
File.Delete(Path, dName)
End If
End Sub