Copies the static files from one directory to another.  If this command is run, we assume the user wants to overwrite any existing files.
767886
def copy_dir(self, source, dest, level=0):
        ''''''
        encoding = settings.DEFAULT_CHARSET or 'utf8'
        msglevel = 2 if level == 0 else 3
        self.message('Directory: {}'.format(source), msglevel, level)

        # create a directory for this app
        if not os.path.exists(dest):
            self.message('Creating directory: {}'.format(dest), msglevel, level+1)
            os.mkdir(dest)

        # go through the files in this app
        for fname in os.listdir(source):
            source_path = os.path.join(source, fname)
            dest_path = os.path.join(dest, fname)
            ext = os.path.splitext(fname)[1].lower()

            # get the score for this file
            score = 0
            for rule in self.rules:
                score += rule.match(fname, level, TYPE_DIRECTORY if os.path.isdir(source_path) else TYPE_FILE)

            # if score is not above zero, we skip this file
            if score <= 0:
                self.message('Skipping file with score {}: {}'.format(score, source_path), msglevel, level+1)
                continue

            ### if we get here, we need to copy the file ###

            # if a directory, recurse to it
            if os.path.isdir(source_path):
                self.message('Creating directory with score {}: {}'.format(score, source_path), msglevel, level+1)
                # create it in the destination and recurse
                if not os.path.exists(dest_path):
                    os.mkdir(dest_path)
                elif not os.path.isdir(dest_path):  # could be a file or link
                    os.unlink(dest_path)
                    os.mkdir(dest_path)
                self.copy_dir(source_path, dest_path, level+1)

            # if a regular Javscript file, run through the static file processors (scripts group)
            elif ext == '.js' and not self.options.get('no_minify') and jsmin:
                self.message('Including and minifying file with score {}: {}'.format(score, source_path), msglevel, level+1)
                with open(source_path, encoding=encoding) as fin:
                    with open(dest_path, 'w', encoding=encoding) as fout:
                        minified = minify(fin.read(), jsmin)
                        fout.write(minified)


            # if a CSS file, run through the static file processors (styles group)
            elif ext == '.css' and not self.options.get('no_minify') and cssmin:
                self.message('Including and minifying file with score {}: {}'.format(score, source_path), msglevel, level+1)
                with open(source_path, encoding=encoding) as fin:
                    with open(dest_path, 'w', encoding=encoding) as fout:
                        minified = minify(fin.read(), cssmin)
                        fout.write(minified)

            # otherwise, just copy the file
            else:
                self.message('Including file with score {}: {}'.format(score, source_path), msglevel, level+1)
                shutil.copy2(source_path, dest_path)
111939
def copy_bulma_files(self):
        
        original_bulma_dir = os.path.join(
            os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
            'static',
            'bulma'
        )
        shutil.copytree(original_bulma_dir, self.static_root_bulma_dir)
1296624
def copy_from_scratch(file_mapping, dry_run=True):
        
        for key, value in file_mapping.items():
            if dry_run:
                print ("copy %s %s" % (value, key))
            else:
                try:
                    outdir = os.path.dirname(key)
                    os.makedirs(outdir)
                except OSError:
                    pass
                print ("copy %s %s" % (value, key))
                copyfile(value, key)
        return file_mapping
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();
        }
    }
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())
592233
public static boolean copyFilesFromDirectoryToDirectory(File origDir,
															File destDir) {

		if (!origDir.exists()) {
			return false;
		}
		
		if (!destDir.exists()) {
			destDir.mkdirs();
		}
		
		File array[]=origDir.listFiles();
		if ( array!= null) {
			for (File file : array) {
				File destFile = new File(destDir, file.getName());
				if (file.isDirectory()) {
					copyFilesFromDirectoryToDirectory(file, destFile);
				} else {
					if (!copyFile(file, destFile)) {
						return false;
					}
				}
			}
		} else {
			return false;
		}

		return true;
	}
327288
static function copyDirectory($source, $target, $overwrite = true)
    {
        $scanResult = static::scanDirectory($source);
        if (!$scanResult) return false;
        if (!is_dir($target)) self::createDirectory($target);

        try {
            $sourceRealPath = realpath($source);
            foreach ($scanResult['files'] as $file) {
                $targetRealPath = realpath($target) . '/' . ltrim(substr($file, strlen($sourceRealPath)), '/');
                static::copyFile($file, $targetRealPath, $overwrite);
            }
            return true;
        } catch (\Throwable $throwable) {
            return false;
        }
    }
904561
def copy_file(self, path, prefixed_path, source_storage):
        
        args = (path, prefixed_path, source_storage)
        if settings.threads:
            self.tasks.append(args)
        else:
            self.do_copy_file(args)
64417
public static boolean copy(FileSystem srcFS, Path src, 
                             FileSystem dstFS, Path dst, 
                             boolean deleteSource,
                             Configuration conf) throws IOException {
    return copy(srcFS, src, dstFS, dst, deleteSource, true, conf);
  }
377823
def clone_source_dir(source_dir, dest_dir):
    
    if os.path.isdir(dest_dir):
        print('removing', dest_dir)
        shutil.rmtree(dest_dir)
    shutil.copytree(source_dir, dest_dir)
959702
public static void copyFile(String fileName, String newFileName, boolean overwriteExisting) throws IOException {
		copyFile(new File(fileName), newFileName, overwriteExisting);
	}
1011863
function copy(files, options) {
    var copied = false
    files.forEach(function(file) {
      var src = file.src
      // Use source for destination if no destionation is available
      // This is done here so globbing can use the original dest
      var dest = file.dest || src

      // Add source prefix if not already added
      if (src.indexOf(options.srcPrefix + path.sep) !== 0) {
        src = path.join(options.srcPrefix, src)
      }

      // Add dest prefix if not already added
      if (dest.indexOf(options.destPrefix + path.sep) !== 0) {
        dest = path.join(options.destPrefix, dest)
      }

      // Copy main files if :main is specified
      var main = rmain.exec(src)
      if (main) {
        copied = copy(getMain(main[1], options, dest), options) || copied
        return
      }

      // Copy folders
      if (grunt.file.isDir(src)) {
        grunt.file.recurse(src, function(abspath, rootdir, subdir, filename) {
          copied = true
          grunt.file.copy(abspath, path.join(dest, subdir || '', filename), options.copyOptions)
        })
        log.writeln(src + ' -> ' + dest)
        // Copy files
      } else if (grunt.file.exists(src)) {
        if (!rperiod.test(path.basename(dest))) {
          dest = path.join(dest, path.basename(src))
        }
        copied = true
        grunt.file.copy(src, dest, options.copyOptions)
        log.writeln(src + ' -> ' + dest)
        // Glob
      } else {
        var matches = glob.sync(src)
        if (matches.length) {
          matches = convertMatches(matches, options, file.dest)
          copied = copy(matches, options) || copied
        } else {
          log.warn(src + ' was not found')
        }
      }
    })
    return copied
  }
820700
def _copy(self, filename, destination):   # pylint: disable=no-self-use
        
        full_filename = os.path.abspath(os.path.expanduser(filename))

        if os.path.isdir(full_filename):
            shutil.copytree(full_filename, destination)
        elif os.path.isfile(full_filename):
            shutil.copyfile(full_filename, destination)
247532
def do_copy_file(self, args):
        
        path, prefixed_path, source_storage = args

        reset_connection(self.storage)

        if self.collectfast_enabled and not self.dry_run:
            try:
                if not should_copy_file(
                        self.storage, path, prefixed_path, source_storage):
                    return False
            except Exception as e:
                if settings.debug:
                    raise
                # Ignore errors and let default collectstatic handle copy
                self.stdout.write(smart_str(
                    "Ignored error in Collectfast:\n%s\n--> Continuing using "
                    "default collectstatic." % e))

        self.num_copied_files += 1
        return super(Command, self).copy_file(
            path, prefixed_path, source_storage)
56258
function copy(inputdir, outputdir, options) {
	const _options = Object.assign({ dir: '.' }, options);
	fsPlus.copySync(path.join(inputdir, _options.dir), outputdir);
	return Promise.resolve();
}
320620
def process_copies(input_dir, target_dir, excludes):
    
    copies = find_copies(input_dir, excludes)
    for c in copies:
        output_file = c.replace(input_dir, target_dir)
        copy_file(c,  output_file)
184555
def copy_file(self, dest_folder_id, source_file_id, on_duplicate=None):
        
        path = {}
        data = {}
        params = {}

        # REQUIRED - PATH - dest_folder_id
        """ID"""
        path["dest_folder_id"] = dest_folder_id

        # REQUIRED - source_file_id
        """The id of the source file"""
        data["source_file_id"] = source_file_id

        # OPTIONAL - on_duplicate
        """What to do if a file with the same name already exists at the destination.
        If such a file exists and this parameter is not given, the call will fail.
        
        "overwrite":: Replace an existing file with the same name
        "rename":: Add a qualifier to make the new filename unique"""
        if on_duplicate is not None:
            self._validate_enum(on_duplicate, ["overwrite", "rename"])
            data["on_duplicate"] = on_duplicate

        self.logger.debug("POST /api/v1/folders/{dest_folder_id}/copy_file with query params: {params} and form data: {data}".format(params=params, data=data, **path))
        return self.generic_request("POST", "/api/v1/folders/{dest_folder_id}/copy_file".format(**path), data=data, params=params, single_item=True)