public boolean delete(File file) {
boolean bFlag = false;
if (file.isFile()) {
bFlag = file.delete();
} else if (file.isDirectory()) {
File[] childFiles = file.listFiles();
if (childFiles == null || childFiles.length == 0) {
bFlag = file.delete();
} else {
for (int i = 0; i < childFiles.length; i++) {
bFlag = delete(childFiles[i]);
if (!bFlag) {
break;
}
}
if (bFlag) {
bFlag = file.delete();
}
}
}
return bFlag;
}