删除指定路径下所有空文件夹

给定路径即可
/**
	 * @author mikki
	 * @date 2009-05-20
	 * @aim delete the path of the folder
	 * @param path
	 * @return null
	 */
	public static void deleteFolder(String path) {
		File folder=new File(path);
		if (folder == null || !folder.exists()) {
			return;
		}
		if (folder.isFile()) {
			return;
		}
		if(folder.list().length==0){
			folder.delete();
			return;
		}
		File[] files = folder.listFiles();
		for (File file : files) {
			if(file.exists()){
			DeleteFile.deleteFolder(file.getAbsolutePath());
			}
		}
	}

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