Android Question How to delete a folder with folder contents

Discussion in 'Android Questions' started by Mashiane, Mar 8, 2015.

  1. Mashiane

    Mashiane Expert Licensed User


    How can I delete a folder with its entire contents? eg using File.Delete(File.DirRootExternal, "/MyProject")

    Please help.
  2. Mahares

    Mahares Well Known Member Licensed User

    You must delete the files via a list before you can delete the folder:
    MyList=File.ListFiles(File.DirRootExternal & "/MyProject")
    For i= MyList.Size-1 To 0 Step -1
    File.Delete(File.DirRootExternal & "/MyProject",MyFile)
    or you can use MLFiles library:

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

    Mashiane Expert Licensed User

    Thanks a lot Mahares, will check it out...
  4. DonManfred

    DonManfred Expert Licensed User

    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) :)
  5. Mashiane

    Mashiane Expert Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice