删除文件夹

deleteAllFilesOfDir(new File("/mnt/nand/jzby"));

public static void deleteAllFilesOfDir(File path) {
  if (!path.exists())
   return;
  if (path.isFile()) {
   path.delete();
   return;
  }
  File[] files = path.listFiles();
  for (int i = 0; i < files.length; i++) {
   deleteAllFilesOfDir(files[i]);
  }
  path.delete();
 }

你可能感兴趣的:(删除文件夹)