private void checkFiles(FileSystem fs) throws IOException {
    long now = new Date().getTime();
    for (Type type : Type.values()) {
      try {
        for (FileStatus status : fs.listStatus(new Path(
            HDFSStorage.getPath(type, storage_root)))) {
          if (now - status.getModificationTime() > maxage) {
            LOG.info("Deleting " + status.getPath().toString());
            fs.delete(status.getPath(), true);
          }
        }
      } catch (Exception e) {
        // Nothing to find for this type.
      }
    }
  }
Loop through all the files, deleting any that are older than
maxage.

@param fs
@throws IOException
hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/HDFSCleanup.java