private void copyWildcardToLocal ( List < AlluxioURI > srcPaths , AlluxioURI dstPath ) throws AlluxioException , IOException { File dstFile = new File ( dstPath . getPath ( ) ) ; if ( dstFile . exists ( ) && ! dstFile . isDirectory ( ) ) { throw new InvalidPathException ( ExceptionMessage . DESTINATION_CANNOT_BE_FILE . getMessage ( ) ) ; } if ( ! dstFile . exists ( ) ) { if ( ! dstFile . mkdirs ( ) ) { throw new IOException ( "Fail to create directory: " + dstPath ) ; } else { System . out . println ( "Create directory: " + dstPath ) ; } } List < String > errorMessages = new ArrayList <> ( ) ; for ( AlluxioURI srcPath : srcPaths ) { try { File dstSubFile = new File ( dstFile . getAbsoluteFile ( ) , srcPath . getName ( ) ) ; copyToLocal ( srcPath , new AlluxioURI ( dstPath . getScheme ( ) , dstPath . getAuthority ( ) , dstSubFile . getPath ( ) ) ) ; } catch ( IOException e ) { errorMessages . add ( e . getMessage ( ) ) ; } } if ( errorMessages . size ( ) != 0 ) { throw new IOException ( Joiner . on ( ' ' ) . join ( errorMessages ) ) ; } }
Copies a list of files or directories specified by srcPaths from the Alluxio filesystem to dstPath in the local filesystem . This method is used when the input path contains wildcards .