code: static void deleteDirContents(JobConf conf, File dir) throws IOException {
      FileSystem fs = FileSystem.getLocal(conf);
      if (fs.exists(new Path(dir.getAbsolutePath()))) {
        File contents[] = dir.listFiles();
        if (contents != null) {
          for (int i = 0; i < contents.length; i++) {
            if (!fs.delete(new Path(contents[i].getAbsolutePath()), true)) {
              LOG.warn("Unable to delete "+ contents[i]);
            }
          }
        }
      }
      else {
        LOG.warn(dir + " does not exist.");
      }
    }
docs: Makes dir empty directory(does not delete dir itself).