String FILE_SEPARATOR = System.getProperty("file.separator");
// If it is a directory, empty it first
if (p_file.isDirectory()) {
String[] dirList = p_file.list();
for (int i = 0; i < dirList.length; i++) {
File aFile = new File(
p_file.getPath() + FILE_SEPARATOR + dirList[i]);
if (aFile.isDirectory()) {
deleteFile(aFile);
}
aFile.delete();
}
}
p_file.delete();