public static void listStatusRecursively(FileSystem fs, FileStatus fileStatus,
      List<FileStatus> results) throws IOException {
    if (isS3a(fs)) {
      // S3A file system has an optimized recursive directory listing implementation however it doesn't support filtering.
      // Therefore we filter the result set afterwards. This might be not so optimal in HDFS case (which does a tree walking) where a filter could have been used.
      listS3FilesRecursive(fileStatus, fs, results);
    } else {
      generalListStatusRecursively(fs, fileStatus, results);
    }
  }
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