public static void copy(ImmutableList<Path> sourceFiles, Path destDir) throws IOException {
    for (Path sourceFile : sourceFiles) {
      PathConsumer copyPathConsumer =
          path -> {
            // Creates the same path in the destDir.
            Path parent = Verify.verifyNotNull(sourceFile.getParent());
            Path destPath = destDir.resolve(parent.relativize(path));
            if (Files.isDirectory(path)) {
              Files.createDirectories(destPath);
            } else {
              Files.copy(path, destPath);
            }
          };

      if (Files.isDirectory(sourceFile)) {
        new DirectoryWalker(sourceFile).walk(copyPathConsumer);
      } else {
        copyPathConsumer.accept(sourceFile);
      }
    }
  }
Copies {@code sourceFiles} to the {@code destDir} directory.

@param sourceFiles the list of source files.
@param destDir the directory to copy the files to.
@throws IOException if the copy fails.
jib-core/src/main/java/com/google/cloud/tools/jib/filesystem/FileOperations.java