Android Question How to delete a folder with folder contents

Mahares

Well Known Member
Licensed User
You must delete the files via a list before you can delete the folder:
B4X:
MyList=File.ListFiles(File.DirRootExternal & "/MyProject")
For i= MyList.Size-1 To 0 Step -1
  MyFile=MyList.Get(i)
  File.Delete(File.DirRootExternal & "/MyProject",MyFile)
Next
or you can use MLFiles library: http://www.b4x.com/android/forum/threads/file-handling-library.19247/

http://www.b4x.com/android/documentation.html

rmrf (Fname As String) As Boolean
Remove (delete) a directory recursively.
ALL files and sub-directories will be deleted, EMPTY OR NOT.
 
Top