Copies a file from the local files directory into :param:`dest`
        gzip compression settings are ignored for local files
557790
def get_file(self,
                 path,
                 dest='',
                 makedirs=False,
                 saltenv='base',
                 gzip=None,
                 cachedir=None):
        '''
        
        '''
        path = self._check_proto(path)
        fnd = self._find_file(path, saltenv)
        fnd_path = fnd.get('path')
        if not fnd_path:
            return ''

        return fnd_path
512915
def _do_copy_path(self, srcpath, dest=None):
        '''
        '''
        if self._is_forbidden_path(srcpath):
            self._log_debug("skipping forbidden path '%s'" % srcpath)
            return ''

        if not dest:
            dest = srcpath

        if self.use_sysroot():
            dest = self.strip_sysroot(dest)

        try:
            st = os.lstat(srcpath)
        except (OSError, IOError):
            self._log_info("failed to stat '%s'" % srcpath)
            return

        if stat.S_ISLNK(st.st_mode):
            self._copy_symlink(srcpath)
            return
        else:
            if stat.S_ISDIR(st.st_mode) and os.access(srcpath, os.R_OK):
                self._copy_dir(srcpath)
                return

        # handle special nodes (block, char, fifo, socket)
        if not (stat.S_ISREG(st.st_mode) or stat.S_ISDIR(st.st_mode)):
            ntype = _node_type(st)
            self._log_debug("creating %s node at archive:'%s'"
                            % (ntype, dest))
            self._copy_node(srcpath, st)
            return

        # if we get here, it's definitely a regular file (not a symlink or dir)
        self._log_debug("copying path '%s' to archive:'%s'" % (srcpath, dest))

        # if not readable(srcpath)
        if not st.st_mode & 0o444:
            # FIXME: reflect permissions in archive
            self.archive.add_string("", dest)
        else:
            self.archive.add_file(srcpath, dest)

        self.copied_files.append({
            'srcpath': srcpath,
            'dstpath': dest,
            'symlink': "no"
        })
100208
function copyFile(source, dest) {

  fs.stat(dest, function (err, stats) {

    // If there was an error that is NOT that the file doesn't exist, then throw it.
    if (err && err.code !== 'ENOENT') {
      throw new Error(err);
    }

    // If the file exists then skip it.
    if (typeof stats === 'object') {
      process.stdout.write(`File exists: skipping (${dest})\n`);
    }

    return fs.createReadStream(source)
      .pipe(fs.createWriteStream(dest));

  });

}
1314091
def _Gunzip(gzipped_content):
    """"""
    f = tempfile.NamedTemporaryFile(suffix='gz', mode='w+b', delete=False)
    try:
        f.write(gzipped_content)
        f.close()  # force file synchronization
        with gzip.open(f.name, 'rb') as h:
            decompressed_content = h.read()
        return decompressed_content
    finally:
        os.unlink(f.name)
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
1055572
def uncompress_files(original, destination):
    
    with zipfile.ZipFile(original) as zips:
        extract_path = os.path.join(destination)
        zips.extractall(extract_path)
1369123
def copy_file(src, dest):
	
	try:
		shutil.copy2(src , dest)
	except Exception as ex:
		print('ERROR copying file' + str(ex))
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)
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)
28575
def copyfile(src, dest, no_progress_bar=False, name=None):
    """"""
    from dvc.progress import progress

    copied = 0
    name = name if name else os.path.basename(dest)
    total = os.stat(src).st_size

    if os.path.isdir(dest):
        dest = os.path.join(dest, os.path.basename(src))

    with open(src, "rb") as fsrc, open(dest, "wb+") as fdest:
        while True:
            buf = fsrc.read(LOCAL_CHUNK_SIZE)
            if not buf:
                break
            fdest.write(buf)
            copied += len(buf)
            if not no_progress_bar:
                progress.update_target(name, copied, total)

    if not no_progress_bar:
        progress.finish_target(name)
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)
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
  }
18603
protected void copyFile(File src, File dest, Replacement replaceFn) throws IOException {
        boolean isSource = isSourceFile(src);
        copyFile(src, dest, replaceFn, isSource);
    }
281410
def _copy(src_file, dest_path):
  """"""
  tf.io.gfile.makedirs(os.path.dirname(dest_path))
  with tf.io.gfile.GFile(dest_path, 'wb') as dest_file:
    while True:
      data = src_file.read(io.DEFAULT_BUFFER_SIZE)
      if not data:
        break
      dest_file.write(data)
698347
function copy(src, dest) {
    if (!src || !dest)
        return false;
    try {
        fs_extra_1.copySync(src, dest);
        logger_1.log.notify("copied " + src + " to " + dest + ".");
        return true;
    }
    catch (ex) {
        logger_1.log.warn("failed to copy " + src + " to " + dest + ".");
        return false;
    }
}
886788
function copyDirSync(src, dest) {
  if (fs.lstatSync(src).isDirectory()) {
    const files = fs.readdirSync(src);
    files.forEach((file) => {
      const curSource = path.join(src, file);
      const curDest = path.join(dest, file);
      if (fs.lstatSync(curSource).isDirectory()) {
        if (!fs.existsSync(curDest)) {
          createDir(curDest);
        }
        copyDirSync(curSource, curDest);
      } else {
        copyFileSync(curSource, curDest);
      }
    });
  }
}
204999
private void copyFile(String path, File dest) {
        String resourceName= "native/" + path;
        try
        {
            LOG.debug("Copy from resource <"+resourceName+"> to target <"+dest.getAbsolutePath()+">");
            if (copy(getClass().getResourceAsStream(resourceName), dest.getAbsolutePath()))
            {
                if (dest.exists())
                {
                    LOG.debug("Target <"+dest.getAbsolutePath()+"> exists");
                }
                else
                {
                    LOG.fatal("Target <"+dest.getAbsolutePath()+"> does not exist");
                }
            }
            else
            {
                LOG.fatal("Copy resource to target <"+dest.getAbsolutePath()+"> failed");
            }
        }
        catch (NullPointerException ex)
        {
            LOG.error("Could not find ffmpeg executable for "+resourceName+" is the correct platform jar included?");
            throw ex;
        }
    }