Copies the files listed in ``sources`` to destination. Source are
        removed if copy is set to False.
503201
def _paste(self, sources, destination, copy):
        
        for src in sources:
            debug('%s <%s> to <%s>' % (
                'copying' if copy else 'cutting', src, destination))
            perform_copy = True
            ext = os.path.splitext(src)[1]
            original = os.path.splitext(os.path.split(src)[1])[0]
            filename, status = QtWidgets.QInputDialog.getText(
                self.tree_view, _('Copy'), _('New name:'),
                QtWidgets.QLineEdit.Normal, original)
            if filename == '' or not status:
                return
            filename = filename + ext
            final_dest = os.path.join(destination, filename)
            if os.path.exists(final_dest):
                rep = QtWidgets.QMessageBox.question(
                    self.tree_view, _('File exists'),
                    _('File <%s> already exists. Do you want to erase it?') %
                    final_dest,
                    QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
                    QtWidgets.QMessageBox.No)
                if rep == QtWidgets.QMessageBox.No:
                    perform_copy = False
            if not perform_copy:
                continue
            try:
                if os.path.isfile(src):
                    shutil.copy(src, final_dest)
                else:
                    shutil.copytree(src, final_dest)
            except (IOError, OSError) as e:
                QtWidgets.QMessageBox.warning(
                    self.tree_view, _('Copy failed'), _('Failed to copy "%s" to "%s".\n\n%s' %
                                                        (src, destination, str(e))))
                _logger().exception('failed to copy "%s" to "%s', src,
                                    destination)
            else:
                debug('file copied %s', src)
            if not copy:
                debug('removing source (cut operation)')
                if os.path.isfile(src):
                    os.remove(src)
                else:
                    shutil.rmtree(src)
                self.tree_view.files_renamed.emit([(src, final_dest)])
222436
def _copy_settings_file(source, destination, name):
    

    if os.path.exists(destination):
        try:
            ch = six.moves.input(
                'File %s already exists, overwrite? y/[n]):' % destination)
            if ch not in ('Y', 'y'):
                return
        except KeyboardInterrupt:
            return

    filepath = os.path.dirname(destination)
    if not os.path.exists(filepath):
        os.makedirs(filepath)

    print('Copying default %s to %s' % (name, destination))
    shutil.copy(source, destination)
    os.chmod(destination, 0o664)
1277112
def copy_selected_sources(cls, roi, source_names):
        
        roi_new = cls.make_roi()
        for source_name in source_names:
            try:
                src_cp = roi.copy_source(source_name)
            except Exception:
                continue
            roi_new.load_source(src_cp, build_index=False)
        return roi_new
656053
def copy(source, destination):
    
    if os.path.isdir(source):
        return __copytree(source, destination)
    else:
        return __copyfile2(source, destination)
1255656
public void copy(ConnectionContext source) {
        this.connection = source.connection;
        this.session = source.session;
        this.destination = source.destination;
    }
906748
public static void copyFiles(String[] files, String[] destinationFiles) throws IOException {
        copyFiles(getFiles(files), getFiles(destinationFiles));
    }
378414
public static function copy(string $source, string $destination, array $options = []) : bool {
		if (is_dir($source)) {
			// we need to skip directories
			if (!empty($options['skip_directories']) && in_array(basename($source), $options['skip_directories'])) {
				return true;
			}
			// open directory for reading
			$dir = opendir($source);
			if (!file_exists($destination)) {
				if (!self::mkdir($destination)) return false;
			}
			while (($file = readdir($dir)) !== false) {
				if ($file == '.' || $file == '..') continue;
				if (empty($options['skip_files']) || (!empty($options['skip_files']) && !in_array($file, $options['skip_files']))) {
					if (!self::copy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file, $options)) return false;
				}
			}
			closedir($dir);
			return true;
		} else {
			return copy($source, $destination);
		}
	}
789786
def copy_directory(src, dest, force=False):
    ''' 
    '''
    if os.path.exists(dest) and force is True:
        shutil.rmtree(dest)

    try:
        shutil.copytree(src, dest)
    except OSError as e:
        # If the error was caused because the source wasn't a directory
        if e.errno == errno.ENOTDIR:
            shutil.copy(src, dest)
        else:
            bot.error('Directory not copied. Error: %s' % e)
            sys.exit(1)
1145944
def recursive_copy(source, dest):
    '''
    
    '''
    for root, _, files in salt.utils.path.os_walk(source):
        path_from_source = root.replace(source, '').lstrip(os.sep)
        target_directory = os.path.join(dest, path_from_source)
        if not os.path.exists(target_directory):
            os.makedirs(target_directory)
        for name in files:
            file_path_from_source = os.path.join(source, path_from_source, name)
            target_path = os.path.join(target_directory, name)
            shutil.copyfile(file_path_from_source, target_path)
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);
        });
    });
}
709709
function copyFiles(sourceDir, files, options = {}) {
	const { overwrite = true, errorOnExist } = options;

	_.castArray(files).forEach(file => {
		const sourcePath = path.resolve(sourceDir, file);
		if (!fs.existsSync(sourcePath)) {
			throw new MrmError(`copyFiles: source file not found: ${sourcePath}`);
		}

		const targetExist = fs.existsSync(file);
		if (targetExist && !overwrite) {
			if (errorOnExist) {
				throw new MrmError(`copyFiles: target file already exists: ${file}`);
			}
			return;
		}

		const content = read(sourcePath);

		// Skip copy if file contents are the same
		if (content === read(file)) {
			return;
		}

		updateFile(file, content, targetExist);
	});
}
1187095
public function copyToDirectory($source, $destination)
		{
			//check to make sure the file exists
			if(file_exists($source))
			{
				copy($source,$destination);
			}
			//check to make sure the file exists
			if(file_exists($destination))
			{
				return true;
			} 
			else 
			{
				return false;
			}
		}
1153363
public static void copy(InputStream source, OutputStream destination) throws IOException
    {
        Check.notNull(source);
        Check.notNull(destination);

        final byte[] buffer = new byte[BUFFER_COPY];
        while (true)
        {
            final int read = source.read(buffer);
            if (read == -1)
            {
                break;
            }
            destination.write(buffer, 0, read);
        }
    }
739423
def copy_contents(self, fileinstance, progress_callback=None,
                      chunk_size=None, **kwargs):
        """"""
        if not fileinstance.readable:
            raise ValueError('Source file instance is not readable.')
        if not self.size == 0:
            raise ValueError('File instance has data.')

        self.set_uri(
            *self.storage(**kwargs).copy(
                fileinstance.storage(**kwargs),
                chunk_size=chunk_size,
                progress_callback=progress_callback))
892668
def copy(path, destination, options = {})
      opts = options.nil? ? {} : options.dup
      opts[:headers] = options[:headers].nil? ? {} : options[:headers].dup
      opts[:headers]['Destination'] = destination
      execute('COPY', path, opts)
    end
918206
def copy(destination: site.path, mirror: false)
      fail 'Must specify a destination' if destination.nil?
      exclude = options[:copy_exclude]
      exclude.concat config[:persistent] unless config[:persistent].nil?
      Utils.copy_directory directory, destination, exclude: exclude, mirror: mirror
      self
    end
1369864
public function copyFiles($source, $target, $files)
    {
        foreach ($files as $file) {
            $this->copyFile($source, $target, $file);
        }
    }