private Collection < FileStatus > handleFile ( final FileStatus file , final JobContext job ) throws IOException { final List < FileStatus > results = Lists . newArrayList ( ) ; if ( file . isDir ( ) ) { final Path p = file . getPath ( ) ; LOG . debug ( "Expanding {}" , p ) ; final FileSystem fs = p . getFileSystem ( job . getConfiguration ( ) ) ; final FileStatus [ ] children = fs . listStatus ( p ) ; for ( FileStatus child : children ) { results . addAll ( handleFile ( child , job ) ) ; } } else { results . add ( file ) ; } return results ; }
If we have a directory recursively gather the files we care about for this job .