1

I am trying to move a file using java, from one folder to another folder, however the folders are on different hard drives, which fails to work with the renameTo method. I only need this feature to work on linux...

-jason

4

2 回答 2

2

Moving files between different filesystems requires you to copy them. The vanilla JDK doesn't have any method to do that, you'll have to do it yourself (e.g. by using FileInputStream / FileOutputStream).

Also check out this thread.

于 2010-11-05T04:36:12.863 回答
1

如果要移动不同文件系统上的文件。复制和删除。

Apache IO FileUtils

于 2010-11-05T05:05:42.247 回答