I use this code to delete all files:
File root = new File(\"root path\");
File[] Files = root.listFiles();
if(Files != null) {
int j;
for(j = 0; j < F
// Delete folder and its contents
public static void DeleteFolder(File folder)
{
try
{
FileUtils.deleteDirectory(folder);
} catch (Exception ex)
{
Log.e(" Failed delete folder: ", ex.getMessage());
}
}
// Delete folder contents only
public static void DeleteFolderContents(File folder)
{
try
{
FileUtils.cleanDirectory(folder);
} catch (Exception ex)
{
Log.e(" Failed delete folder contents: ", ex.getMessage());
}
}
Docs: org.apache.commons.io.FileUtils.cleanDirectory