private static List < CopyPath > expandSingle ( Path src , Path dstPath ) throws IOException { List < Path > expandedPaths = new ArrayList < Path > ( ) ; FileSystem fs = src . getFileSystem ( defaultConf ) ; FileStatus [ ] stats = fs . globStatus ( src ) ; if ( stats == null || stats . length == 0 ) { throw new IOException ( "Path : " + src + " is invalid" ) ; } for ( FileStatus stat : stats ) { expandedPaths . add ( stat . getPath ( ) ) ; } List < CopyPath > expandedDirs = expandDirectories ( fs , expandedPaths , dstPath ) ; return expandedDirs ; }
Expand a single file if its a file pattern list out all files matching the pattern if its a directory return all files under the directory .