Android Question How to delete a folder with folder contents

Mahares

Expert
Licensed User
Longtime 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: https://www.b4x.com/android/forum/threads/file-handling-library.19247/

https://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.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…