java - Java 中的 Files.move(Path, Path)

标签 java filesystems move

通过阅读this教程,我遇到过这部分我不太清楚。

Empty directories can be moved. If the directory is not empty, the move is allowed when the directory can be moved without moving the contents of that directory.

我显然彻底明白了,空目录是可以 move 的。然而,引用的第二部分在我看来有点令人困惑。任何人都可以用换句话说来表达相同的概念吗?提前致谢。

最佳答案

On UNIX systems, moving a directory within the same partition generally consists of renaming the directory. In that situation, this method works even when the directory contains files.

这实际上是您发布的链接中的下一句,它提供了一个示例,说明即使目录不为空也可以使用 move 。

关于java - Java 中的 Files.move(Path, Path),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16341342/

相关文章:

java - 为什么 IntelliJ 在使用本地数据源时找不到数据库用户凭据?

c# - FolderBrowserDialog 是否有更新版本?

react-native - 如何从 React Native 中的 Assets uri 获取文件名

java - Jackson 反序列化包含有效 json 的字符串值

java - 证明旧的 Date Java API 不是线程安全的

java - @Nonnull 注释只是标记?

java.io.IOException : No space left on device Android 异常

JavaScript 使用箭头键 move 图像

android - 在屏幕android上随机 move 按钮

c++ - vector 、 move 语义、nothrow 和 g++ 4.7