code: public final static void move(File fromFile, File toFile)
              throws IOException {
          // try the simple way first.
          if (fromFile.renameTo(toFile)) {
              return;
          }
  
          // copy to the temp file, then rename to the desired name.
          checkThatFileDoesntExist(toFile);
          File tempFile = createTempFile(toFile);
          checkThatFileDoesntExist(tempFile);
          copy(fromFile, tempFile);
          tempFile.renameTo(toFile);
          // delete the old one
          if (!fromFile.delete()) {
              throw new IOException("Failed to delete '" + fromFile.getParent()
                      + "'");
          }
      }
docs: <p>
  Move a File
  </p>
  <p>
  The renameTo method does not allow action across NFS mounted filesystems.
  This method is the workaround.
  </p>
  
  @param fromFile
  The existing File
  @param toFile
  The new File
  @throws IOException
  if any problems occur