public static Optional < JMProgressiveManager < Path , Path > > copyDirRecursivelyAsync ( Path targetDirPath , Path destinationDirPath , CopyOption ... options ) { Map < Boolean , List < Path > > directoryOrFilePathMap = JMLambda . groupBy ( JMPath . getSubPathList ( targetDirPath ) , JMPath :: isDirectory ) ; JMOptional . getOptional ( directoryOrFilePathMap , true ) . ifPresent ( list -> list . stream ( ) . map ( dirPath -> JMPath . buildRelativeDestinationPath ( destinationDirPath , targetDirPath , dirPath ) ) . forEach ( JMPathOperation :: createDirectories ) ) ; return operateDir ( targetDirPath , destinationDirPath , directoryOrFilePathMap . get ( false ) , bulkPathList -> new JMProgressiveManager <> ( bulkPathList , path -> Optional . ofNullable ( copy ( path , JMPath . buildRelativeDestinationPath ( destinationDirPath , targetDirPath , path ) , options ) ) ) ) ; }
Copy dir recursively async optional .