code: private static void traverseDirs(List<FileStatus> fileStatusesList, FileSystem hdfs,
        Path inputPath, JobFileModifiedRangePathFilter jobFileModifiedRangePathFilter)
            throws IOException
    {
      // get all the files and dirs in the current dir
      FileStatus allFiles[] = hdfs.listStatus(inputPath);
      for (FileStatus aFile: allFiles) {
        if (aFile.isDir()) {
          //recurse here
          traverseDirs(fileStatusesList, hdfs, aFile.getPath(), jobFileModifiedRangePathFilter);
        }
        else {
          // check if the pathFilter is accepted for this file
          if (jobFileModifiedRangePathFilter.accept(aFile.getPath())) {
            fileStatusesList.add(aFile);
          }
        }
      }
    }
docs: Recursively traverses the dirs to get the list of
  files for a given path filtered as per the input path range filter