public static void moveToDirectory(File src,File destDir,boolean createDestDir) throws IOException {
  if (src == null) {
    throw new NullPointerException("Source must not be null");
  }
  if (destDir == null) {
    throw new NullPointerException("Destination must not be null");
  }
  if (!src.exists()) {
    throw new FileNotFoundException("Source '" + src + "' does not exist");
  }
  if (src.isDirectory()) {
    moveDirectoryToDirectory(src,destDir,createDestDir);
  }
 else {
    moveFileToDirectory(src,destDir,createDestDir);
  }
}

public static void moveToDirectory ( File src , File destDir , boolean createDestDir ) throws IOException { if ( src == null ) { throw new NullPointerException ( "Source must not be null" ) ; } if ( destDir == null ) { throw new NullPointerException ( "Destination must not be null" ) ; } if ( ! src . exists ( ) ) { throw new FileNotFoundException ( "Source '" + src + "' does not exist" ) ; } if ( src . isDirectory ( ) ) { moveDirectoryToDirectory ( src , destDir , createDestDir ) ; } else { moveFileToDirectory ( src , destDir , createDestDir ) ; } }
moves a file or directory to the destination directory . < p > when the destination is on another file system , do a " copy and delete " .
