Forum Xamarin Xamarin.Forms

Delete content of folder internal storage android

vkt_rbvkt_rb USMember ✭✭✭
edited October 2016 in Xamarin.Forms

Hi everyone, rigth now I'm in a situation, I need to delete all the files inside of a specific folder in my internal storage, I would like to know which is the best way to do that, I've looked many information of this topic but I still not found how to do this in android . I already have the full path of the folder in a string variable, but Iwould like to know what is the best way to do it in android device

Best Answer


  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Since you have the folder path, delete the entire folder - then remake the folder.
    Otherwise loop through all the files.

  • vkt_rbvkt_rb USMember ✭✭✭

    Hi @ClintStLaurent I just looking for delete the inside files but not the folder, I've could see a kind of logic of how to do it before an yours is one, but right now I don't know how to do it in android, Do you have a example of the code in this OS?

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    You're writing in C#. Its the same .NET call regardless of OS.
    System.IO.File.Delete(string filePath);

  • atataatata Member ✭✭

    @vkt_rb said:

    I shared my code for the community

    @vkt_rb You're the best! Thanks a lot!

Sign In or Register to comment.