标签:system let new ati files else ring file string
用java实现删除目录
public static void main(String[] args) { try { String strFolder = "D:\\aa"; deleteFile(new File(strFolder)); System.out.println("Delete Successful!"); } catch (Exception e) { System.out.println(e.getMessage()); System.out.println("Delete Fail!"); } } public static void deleteFile(File file) { if (file == null || !file.exists()) { return; } File[] files = file.listFiles(); for (File f : files) { if (f.isDirectory()) { deleteFile(f); } else { f.delete(); } } file.delete(); }
标签:system let new ati files else ring file string
原文地址:https://www.cnblogs.com/wzihan/p/12994367.html