public static boolean deleteDirectory(final FileSystem fs, final Path dir) throws IOException {
    return fs.exists(dir) && fs.delete(dir, true);
  }
Delete if exists.
@param fs  filesystem object
@param dir directory to delete
@return True if deleted <code>dir</code>
@throws IOException e
hbase-common/src/main/java/org/apache/hadoop/hbase/util/CommonFSUtils.java