We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileUtils.moveDir();只能移动文件夹里的文件到目标文件夹,源文件夹本身没有移动。 源文件夹只是被删掉了,感觉这样并不符合语义啊。 这样叫FileUtils.moveFilesInDir();会不会更好。
private static boolean copyOrMoveDir(final File srcDir, final File destDir, final OnReplaceListener listener, final boolean isMove) { if (srcDir == null || destDir == null) return false; // destDir's path locate in srcDir's path then return false String srcPath = srcDir.getPath() + File.separator; String destPath = destDir.getPath() + File.separator; if (destPath.contains(srcPath)) return false; if (!srcDir.exists() || !srcDir.isDirectory()) return false; if (!createOrExistsDir(destDir)) return false; //****感觉这里的参数换成destDir.getPath + "/" + srcDir.getName()会更好***** File[] files = srcDir.listFiles(); if (files != null && files.length > 0) { for (File file : files) { File oneDestFile = new File(destPath + file.getName()); if (file.isFile()) { if (!copyOrMoveFile(file, oneDestFile, listener, isMove)) return false; } else if (file.isDirectory()) { if (!copyOrMoveDir(file, oneDestFile, listener, isMove)) return false; } } } return !isMove || deleteDir(srcDir); }
The text was updated successfully, but these errors were encountered:
Blankj
No branches or pull requests
描述 Bug
FileUtils.moveDir();只能移动文件夹里的文件到目标文件夹,源文件夹本身没有移动。
源文件夹只是被删掉了,感觉这样并不符合语义啊。 这样叫FileUtils.moveFilesInDir();会不会更好。
相关代码
The text was updated successfully, but these errors were encountered: