How to delete all files and folders in one folder on Android

Check this link also Delete folder from internal storage in android?.

void deleteRecursive(File fileOrDirectory) {

    if (fileOrDirectory.isDirectory())
        for (File child : fileOrDirectory.listFiles())
            deleteRecursive(child);

    fileOrDirectory.delete();

}

Simplest way would be to use FileUtils.deleteDirectory from the Apache Commons IO library.

File dir = new File("root path");
FileUtils.deleteDirectory(dir);

Bear in mind this will also delete the containing directory.

Add this line in gradle file to have Apache

compile 'org.apache.commons:commons-io:1.3.2'