public static void replaceDirectory(Configuration conf,Path src,Path dest) throws IOException {
  FileSystem fs=dest.getFileSystem(conf);
  if (fs.exists(dest)) {
    LOG.debug("Removing " + dest + " since it exists");
    deleteDirectory(conf,dest);
  }
  LOG.debug("Renaming " + src + " to "+ dest);
  fs.rename(src,dest);
}

public static void replaceDirectory ( Configuration conf , Path src , Path dest ) throws IOException { FileSystem fs = dest . getFileSystem ( conf ) ; if ( fs . exists ( dest ) ) { LOG . debug ( "Removing " + dest + " since it exists" ) ; deleteDirectory ( conf , dest ) ; } LOG . debug ( "Renaming " + src + " to " + dest ) ; fs . rename ( src , dest ) ; }
replace a directory with another directory .
