new-integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/FileUtils.java
public static void copyFolderToPod(String namespace,
                                     String pod,
                                     String container,
                                     Path srcPath,
                                     Path destPath) throws ApiException, IOException {

    Stream<Path> walk = Files.walk(srcPath);
    // find only regular files
    List<String> result = walk.filter(Files::isRegularFile)
        .map(x -> x.toString()).collect(Collectors.toList());

    result.forEach(fileOnHost -> {
      // resolve the given path against this path.
      Path fileInPod = destPath.resolve(srcPath.relativize(Paths.get(fileOnHost)));
      getLogger().info("Copying {0} to {1} ", fileOnHost, fileInPod);

      try {
        // copy each file to the pod.
        Kubernetes.copyFileToPod(namespace, pod, container, Paths.get(fileOnHost), fileInPod);
        getLogger().info("File {0} copied to {1} in Pod {2} in namespace {3} ",
            fileOnHost, fileInPod, pod, namespace);
      } catch (Exception ex) {
        throw new RuntimeException(ex);
      }
    });
  }
/**
   * Copy a directory to a pod in specified namespace.
   * @param namespace namespace in which the pod exists
   * @param pod name of pod where the file will be copied to
   * @param container name of the container inside of the pod
   * @param srcPath source location of the directory
   * @param destPath destination location of the directory
   * @throws ApiException if Kubernetes API client call fails
   * @throws IOException if copy fails
   */
Copy a directory to a pod in specified namespace.
Copy a directory to a pod in specified namespace .
public static void copyFolderToPod(String namespace,
                                     String pod,
                                     String container,
                                     Path srcPath,
                                     Path destPath) throws ApiException, IOException {
    Stream<Path> walk = Files.walk(srcPath);
    List<String> result = walk.filter(Files::isRegularFile)
        .map(x -> x.toString()).collect(Collectors.toList());
    result.forEach(fileOnHost -> {
      Path fileInPod = destPath.resolve(srcPath.relativize(Paths.get(fileOnHost)));
      getLogger().info("Copying {0} to {1} ", fileOnHost, fileInPod);
      try {
        Kubernetes.copyFileToPod(namespace, pod, container, Paths.get(fileOnHost), fileInPod);
        getLogger().info("File {0} copied to {1} in Pod {2} in namespace {3} ",
            fileOnHost, fileInPod, pod, namespace);
      } catch (Exception ex) {
        throw new RuntimeException(ex);
      }
    });
  }
public static void copyFolderToPod ( String namespace , String pod , String container , Path srcPath , Path destPath ) throws ApiException , IOException { Stream < Path > walk = Files . walk ( srcPath ) ; List < String > result = walk . filter ( Files :: isRegularFile ) . map ( x -> x . toString ( ) ) . collect ( Collectors . toList ( ) ) ; result . forEach ( fileOnHost -> { Path fileInPod = destPath . resolve ( srcPath . relativize ( Paths . get ( fileOnHost ) ) ) ; getLogger ( ) . info ( "Copying {0} to {1} " , fileOnHost , fileInPod ) ; try { Kubernetes . copyFileToPod ( namespace , pod , container , Paths . get ( fileOnHost ) , fileInPod ) ; getLogger ( ) . info ( "File {0} copied to {1} in Pod {2} in namespace {3} " , fileOnHost , fileInPod , pod , namespace ) ; } catch ( Exception ex ) { throw new RuntimeException ( ex ) ; } } ) ; }
Copy a directory to a pod in specified namespace.
Copy a directory to a pod in specified namespace .
// find only regular files // resolve the given path against this path. // copy each file to the pod.