import java.io.File;
public class DirectoryIO {
/**
*
* recursivly delete directory
*
* @param directory
*/
public static boolean delete(File directory) {
boolean result = false;
if (directory.isDirectory()) {
File[] files = directory.listFiles();
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
delete(files[i]);
}
files[i].delete();
}
result = directory.delete();
}
return result;
}
}
|