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

jason
  • 1,132
  • 14
  • 32

2 Answers2

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.

Community
  • 1
  • 1
vanza
  • 9,715
  • 2
  • 31
  • 34
1

If you want to move files on different file Systems. Copy and Delete.

Apache IO FileUtils

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
smartnut007
  • 6,324
  • 6
  • 45
  • 52