public static boolean rename(FileSystem fs, Path sourcePath,
                               Path destPath, Configuration conf) throws IOException {
    LOG.info("Renaming " + sourcePath + " to " + destPath);

    // If destPath directory exists, rename call will move the sourcePath
    // into destPath without failing. So check it before renaming.
    if (fs.exists(destPath)) {
      throw new IOException("Cannot rename the source path. The destination "
              + "path already exists.");
    }
    return fs.rename(sourcePath, destPath);
  }
Move a particular file or directory to the trash.
@param fs FileSystem to use
@param f path of file or directory to move to trash.
@param conf
@return true if move successful
@throws IOException
common/src/java/org/apache/hadoop/hive/common/FileUtils.java