code: public static FileStatus[] listFiles (boolean recurse, FileSystem hdfs, Path inputPath,
        JobFileModifiedRangePathFilter jobFileModifiedRangePathFilter) throws IOException
    {
      if (recurse) {
        List<FileStatus> fileStatusesList = new ArrayList<FileStatus>();
        traverseDirs(fileStatusesList, hdfs, inputPath, jobFileModifiedRangePathFilter);
        FileStatus[] fileStatuses = (FileStatus[]) fileStatusesList.toArray(
            new FileStatus[fileStatusesList.size()]);
        return fileStatuses;
      }
      else {
        return hdfs.listStatus(inputPath, jobFileModifiedRangePathFilter);
      }
    }
docs: Gets the list of files for a given path filtered as per the input path range filter
  Can go into directories recursively
  
  @param recurse - whether or not to traverse recursively
  @param hdfs - the file system
  @param inputPath - the path to traverse for getting the list of files
  @param jobFileModifiedRangePathFilter - the filter to include/exclude certain files
  
  @return array of file status.
  @throws IOException