public static RemoteIterator<LocatedFileStatus> listFiles(FileSystem fs, Path path, boolean recursive, PathFilter filter)
        throws IOException {
    return RemoteIterators.filteringRemoteIterator(fs.listFiles(path, recursive),
        status -> filter.accept(status.getPath()));
  }
Attempts to delete a file if it exists.
@param fs FileSystem
@param path Path to be deleted.
common/src/java/org/apache/hadoop/hive/common/FileUtils.java