public static void deleteAllFile(){
String path = Environment.getExternalStorageDirectory().getAbsolutePath()+File.separator+"文件夹名称";
deleteFile(new File(path));
}
public static void deleteFile(File oldPath) {
if (oldPath.isDirectory()) {
File[] files = oldPath.listFiles();
for (File file : files) {
deleteFile(file);
file.delete();
}
}else{
oldPath.delete();
}
}
时间: 2024-10-11 00:45:48