code: public static void copy( Path fileOrDirectory, Path toDir )
    {
      Path copy = PathUtil.create( toDir, PathUtil.getName( fileOrDirectory ) );
      if( PathUtil.isDirectory( fileOrDirectory ) )
      {
        //noinspection ResultOfMethodCallIgnored
        try
        {
          PathUtil.mkdir( copy );
          Files.list( fileOrDirectory ).forEach( child -> copy( child, copy ) );
        }
        catch( IOException e )
        {
          throw new RuntimeException( e );
        }
      }
      else
      {
        //noinspection ResultOfMethodCallIgnored
        try( InputStream is = new BufferedInputStream( Files.newInputStream( fileOrDirectory ) );
             OutputStream os = new BufferedOutputStream( Files.newOutputStream( copy ) ) )
        {
          StreamUtil.copy( is, os );
        }
        catch( Exception e )
        {
          throw new RuntimeException( e );
        }
      }
    }
docs: Recursively copy a file or directory to a directory.