Copy files (binary included) recursively.
541673
async function copyFiles(srcPath: string, destPath: string) {
  return Promise.all(
    walk(srcPath).map(async absoluteSrcFilePath => {
      const relativeFilePath = path.relative(srcPath, absoluteSrcFilePath);
      await copyFile(
        absoluteSrcFilePath,
        path.resolve(destPath, relativeFilePath),
      );
    }),
  );
}
1111182
def copy_images(images, source, target):
    
    image_err = False
    if len(images) > 0:
        images_dir = os.path.join(target, 'images')
        os.makedirs(images_dir)
        for image in images:
            if os.path.isabs(image):
                old_image_file = image
            else:
                old_image_file = os.path.join(source, image)

            new_image_file = os.path.join(images_dir,
                                          os.path.basename(image))
            if os.path.isfile(os.path.abspath(old_image_file)):
                shutil.copy(old_image_file, new_image_file)
            else:
                image_err = True
                logging.error('Unable to find %s' % old_image_file)
    return image_err
1037231
def clone_with_copy(src_path, dest_path):
    
    log.info('Cloning directory tree %s to %s', src_path, dest_path)
    shutil.copytree(src_path, dest_path)
388330
public static void copyDirectories(File[] directories, File[] destinationDirectories) throws IOException {
        int length = Integer.min(directories.length, destinationDirectories.length);
        for (int i = 0; i < length; i++) {
            copyDirectory(directories[i], destinationDirectories[i]);
        }
    }
430761
function copyReadmeFiles() {
    const resolvedSrcReadmePaths = path.resolve(rootDir, srcReadmePaths);

    glob(resolvedSrcReadmePaths, void(0), function(error, files) {
        files.forEach((filePath) => {
        const destReadmePath = filePath.replace(/(\bsrc\b)(?!.*\1)/, destDir);
            fs.copyFileSync(filePath, destReadmePath);
        });
    });
}
50415
def copy_files!
        destination = temp_transformed_path

        if has_base?
          FileUtils.cp_r("#{base_spec.temp_raw_path}/.", destination)
        end

        begin
          FileUtils.cp_r("#{before_path}/.", destination)
        rescue Errno::ENOENT => e
          raise e unless has_base?
        end
      end
399425
public static void copyRecursively(Path source, Path destination) throws IOException {
        if (Files.isDirectory(source))
        {
            Files.createDirectories(destination);
            final Set<Path> sources = listFiles(source);

            for (Path srcFile : sources)
            {
                Path destFile = destination.resolve(srcFile.getFileName());
                copyRecursively(srcFile, destFile);
            }
        }
        else
        {
            Files.copy(source, destination, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);
        }
    }
794535
def recursive_copy(src_dir, dest_dir):
  

  file_io.recursive_create_dir(dest_dir)
  for file_name in file_io.list_directory(src_dir):
    old_path = os.path.join(src_dir, file_name)
    new_path = os.path.join(dest_dir, file_name)

    if file_io.is_directory(old_path):
      recursive_copy(old_path, new_path)
    else:
      file_io.copy(old_path, new_path, overwrite=True)
503875
def copy_to(self, dest, buffering: int = -1):
        '''
        
        '''
        if isinstance(dest, str):
            dest_path = dest
        elif isinstance(dest, FileInfo):
            dest_path = dest.path
        elif isinstance(dest, DirectoryInfo):
            dest_path = dest.path / self.path.name
        else:
            raise TypeError('dest is not one of `str`, `FileInfo`, `DirectoryInfo`')

        with open(self._path, 'rb', buffering=buffering) as source:
            # use x mode to ensure dest does not exists.
            with open(dest_path, 'xb') as dest_file:
                for buffer in source:
                    dest_file.write(buffer)
499775
def copy(self, mutable=False):
        """"""

        if self.not_loaded():
            _cls = self.__class__
            if mutable:
                _cls = MutableGeoRaster
            return _cls.open(self._filename)

        return self.copy_with(mutable=mutable)
603619
def copytree(root_src_dir, root_dst_dir, hardlink=True):
    """"""

    for src_dir, dirs, files in os.walk(root_src_dir):
        dst_dir = src_dir.replace(root_src_dir, root_dst_dir, 1)
        if not os.path.exists(dst_dir):
            os.makedirs(dst_dir)
        for file_ in files:
            src_file = os.path.join(src_dir, file_)
            dst_file = os.path.join(dst_dir, file_)
            try:
                if os.path.exists(dst_file):
                    if hardlink:
                        hfoslog('Removing frontend link:', dst_file,
                                emitter='BUILDER', lvl=verbose)
                        os.remove(dst_file)
                    else:
                        hfoslog('Overwriting frontend file:', dst_file,
                                emitter='BUILDER', lvl=verbose)

                hfoslog('Hardlinking ', src_file, dst_dir, emitter='BUILDER',
                        lvl=verbose)

                if hardlink:
                    os.link(src_file, dst_file)
                else:
                    copy(src_file, dst_dir)
            except PermissionError as e:
                hfoslog(
                    " No permission to remove/create target %s for "
                    "frontend:" % ('link' if hardlink else 'copy'),
                    dst_dir, e, emitter='BUILDER', lvl=error)
            except Exception as e:
                hfoslog("Error during", 'link' if hardlink else 'copy',
                        "creation:", type(e), e, emitter='BUILDER',
                        lvl=error)

            hfoslog('Done linking', root_dst_dir, emitter='BUILDER',
                    lvl=verbose)
361224
def copy(src, dst):
    
    if os.path.isdir(dst):
        dst = os.path.join(dst, os.path.basename(src))
    copyfile(src, dst)
    copymode(src, dst)
688527
def copy_file(self, from_path, to_path, replace=False):
        
        f = self.get_file(from_path)
        if f.copy(to_path, replace):
            self.set_cache_buster(to_path, f.hash())
1026686
def copyFunc(dest, source, env):
    """"""

    if os.path.isdir(source):
        if os.path.exists(dest):
            if not os.path.isdir(dest):
                raise SCons.Errors.UserError("cannot overwrite non-directory `%s' with a directory `%s'" % (str(dest), str(source)))
        else:
            parent = os.path.split(dest)[0]
            if not os.path.exists(parent):
                os.makedirs(parent)
        scons_copytree(source, dest)
    else:
        shutil.copy2(source, dest)
        st = os.stat(source)
        os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)

    return 0
1224249
protected void copyOtherFiles(File projectDir, File srcDir, File outDir, Replacement replaceFn, Set<String> extraIgnorefiles) throws IOException {
        if (archetypeUtils.isValidFileToCopy(projectDir, srcDir, extraIgnorefiles)) {
            if (srcDir.isFile()) {
                copyFile(srcDir, outDir, replaceFn);
            } else {
                outDir.mkdirs();
                String[] names = srcDir.list();
                if (names != null) {
                    for (String name: names) {
                        copyOtherFiles(projectDir, new File(srcDir, name), new File(outDir, name), replaceFn, extraIgnorefiles);
                    }
                }
            }
        }
    }
283487
function copySchemaFiles() {
    const resolvedSrcSchemaPaths = path.resolve(rootDir, srcSchemaPaths);

    glob(resolvedSrcSchemaPaths, void(0), function(error, files) {
        files.forEach((filePath) => {
        const destSchemaPath = filePath.replace(/(\bsrc\b)(?!.*\1)/, destDir);
            fs.copyFileSync(filePath, destSchemaPath);
        });
    });
}
156396
private void copyBaseDirs(File[] baseDirs) {
        this.baseDirs = new File[baseDirs.length];
        for (int i = 0; i < baseDirs.length; i++) {
            this.baseDirs[i] = baseDirs[i].getAbsoluteFile();
        }
    }