private void copyLibraryRecursive ( Path input , Path output ) throws IOException { for ( Path dirItem : Files . list ( input ) . collect ( Collectors . toList ( ) ) ) { Path outputName = output . resolve ( dirItem . getFileName ( ) ) ; if ( Files . isDirectory ( dirItem ) ) { if ( ! Files . exists ( outputName ) ) Files . createDirectory ( outputName ) ; copyLibraryRecursive ( dirItem , outputName ) ; } else { Files . copy ( dirItem , outputName , StandardCopyOption . REPLACE_EXISTING ) ; } } }
Recursive copier for the above copy method . It calls recursively for subdirectories to ensure a full copy