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
File file = new File("C:\\A\\B");
String[] myFiles;
myFiles = file.list();
for (int i=0; i
You can write method like this way :Deletes all files and subdirectories under dir.Returns true if all deletions were successful.If a deletion fails, the method stops attempting to delete and returns false.
public static boolean deleteDir(File dir) {
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i=0; i