提交 7db14503 authored 作者: Thomas Mueller's avatar Thomas Mueller

Some FTP servers report "." and ".." directories.

上级 bed1320d
...@@ -306,10 +306,13 @@ public class FtpClient { ...@@ -306,10 +306,13 @@ public class FtpClient {
*/ */
public void removeDirectoryRecursive(String dir) throws IOException { public void removeDirectoryRecursive(String dir) throws IOException {
for (File f : listFiles(dir)) { for (File f : listFiles(dir)) {
String name = f.getName();
if (f.isDirectory()) { if (f.isDirectory()) {
removeDirectoryRecursive(dir + "/" + f.getName()); if (!name.equals(".") && !name.equals("..")) {
removeDirectoryRecursive(dir + "/" + name);
}
} else { } else {
delete(dir + "/" + f.getName()); delete(dir + "/" + name);
} }
} }
removeDirectory(dir); removeDirectory(dir);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论