private static void listS3FilesRecursive(FileStatus base, FileSystem fs, List<FileStatus> results) throws IOException {
    if (!base.isDirectory()) {
      results.add(base);
      return;
    }
    RemoteIterator<LocatedFileStatus> remoteIterator = fs.listFiles(base.getPath(), true);
    while (remoteIterator.hasNext()) {
      LocatedFileStatus each = remoteIterator.next();
      Path relativePath = makeRelative(base.getPath(), each.getPath());
      if (org.apache.hadoop.hive.metastore.utils.FileUtils.RemoteIteratorWithFilter.HIDDEN_FILES_FULL_PATH_FILTER.accept(relativePath)) {
        results.add(each);
      }
    }
  }
Recursively lists status for all files starting from a particular directory (or individual file
as base case).

@param fs
         file system

@param fileStatus
         starting point in file system

@param results
         receives enumeration of all files found
common/src/java/org/apache/hadoop/hive/common/FileUtils.java