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

DonManfred

Expert
Licensed User
Longtime User
Thanks a lot Mahares, will check it out...
If there is someone who gave a good answer to you you should give some respect back to the author (click the like on his post) :)
 
Upvote 0
Top