Copy a file or folder to a different location.

https://msdn.microsoft.com/en-us/library/office/jj247198%28v=office.15%29.aspx
424647
public function copy(string $fromPath, string $toPath, array $mimeType) : bool
	{
		$fromPath = $this->normalizePath($fromPath);
		
		$toPath = $this->normalizePath($toPath);
		
		// If plain/text, its a folder
		if (substr($mimeType['mimetype'], 0, 4) === 'text') {
			$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFolderByServerRelativeUrl(\''.$this->folderPath.$fromPath.'\')/copyTo(strNewUrl=\''.$this->folderPath.$toPath.'\', bOverWrite=true)';
		} else {
			$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFileByServerRelativeUrl(\''.$this->folderPath.$fromPath.'\')/copyTo(strNewUrl=\''.$this->folderPath.$toPath.'\', bOverWrite=true)';
		}
		
		$options = [
			'headers' => $this->requestHeaders,
		];
			
		$response = $this->send('POST', $requestUrl, $options);
		
		return $response->getStatusCode() === 200 ? true : false;
	}
1065011
def copy_file(self, infile, outfile, check=True):
        
        self.ensure_dir(os.path.dirname(outfile))
        logger.info('Copying %s to %s', infile, outfile)
        if not self.dry_run:
            msg = None
            if check:
                if os.path.islink(outfile):
                    msg = '%s is a symlink' % outfile
                elif os.path.exists(outfile) and not os.path.isfile(outfile):
                    msg = '%s is a non-regular file' % outfile
            if msg:
                raise ValueError(msg + ' which would be overwritten')
            shutil.copyfile(infile, outfile)
        self.record_as_written(outfile)
6342
function copyIntoPlace(extractedPath, targetPath) {
  log.info('Removing', targetPath);
  return kew.nfcall(fs.remove, targetPath).then(function () {
    // Look for the extracted directory, so we can rename it.
    const files = fs.readdirSync(extractedPath);
    for (let i = 0; i < files.length; i++) {
      const file = path.join(extractedPath, files[i]);
      if (fs.statSync(file).isDirectory() && file.indexOf(helper.version) !== -1) {
        log.info('Copying extracted folder', file, '->', targetPath);
        return kew.nfcall(fs.move, file, targetPath);
      }
    }
    log.info('Could not find extracted file', files);
    throw new Error('Could not find extracted file');
  });
}
16268
private static void moveFile(final File fromFile, final File toFile) throws UpdateException {
        try {
            // Create parent directory structure if necessary
            FileUtils.mkParentDirs(toFile);
            Files.move(fromFile.toPath(), toFile.toPath(),
                    StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException ioe) {
            throw new UpdateException("Unable to move temporary file to destination file: " +
                    fromFile + " -> " + toFile + ": " + ioe.toString());
        }
    }
659985
public static Path copyFile(Path src, Path dest, StandardCopyOption... options) throws IORuntimeException {
		Assert.notNull(src, "Source File is null !");
		Assert.notNull(dest, "Destination File or directiory is null !");

		Path destPath = dest.toFile().isDirectory() ? dest.resolve(src.getFileName()) : dest;
		try {
			return Files.copy(src, destPath, options);
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
525736
function copyFileIntoDirectory(srcPath, destPath) {
        return ensureDestinationDirectory(destPath).then(function () {
            return new Promise(function (resolve, reject) {
                fs.readFile(srcPath, 'utf8', function (err, contents) {
                    if (!err) {
                        resolve();
                    } else {
                        reject(err);
                    }
                    fs.outputFile(destPath + '/' + path.basename(srcPath), contents, function (err) {
                        if (!err) {
                            resolve();
                        } else {
                            reject(err);
                        }
                    });
                });
            });
        });
    }
1035038
def copy_file(filename):
    """"""

    print("Updating file %s" % filename)
    out_dir = os.path.abspath(DIRECTORY)

    tags = filename[:-4].split("-")

    tags[-2] = tags[-2].replace("m", "")

    new_name = "-".join(tags) + ".whl"
    wheel_flag = "-".join(tags[2:])

    with InWheelCtx(os.path.join(DIRECTORY, filename)) as ctx:
        info_fname = os.path.join(_dist_info_dir(ctx.path), 'WHEEL')
        infos = pkginfo.read_pkg_info(info_fname)
        print("Changing Tag %s to %s" % (infos["Tag"], wheel_flag))
        del infos['Tag']
        infos.add_header('Tag', wheel_flag)
        pkginfo.write_pkg_info(info_fname, infos)

        ctx.out_wheel = os.path.join(out_dir, new_name)

        print("Saving new wheel into %s" % ctx.out_wheel)
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)
40816
function(location) {
			if (location.substr(contextPath.length).indexOf('/file/') === 0) {
				// Local workspace
				return location.substr(contextPath.length).split("/").slice(3).join('/')
			} else {
				// Shared workspace
				return location.substr(contextPath.length).split('/').slice(5).join('/');
			}
		}
148598
def copyFile(input, output, replace=None):
    """"""

    _found = findFile(output)
    if not _found or (_found and replace):
        shutil.copy2(input, output)
776533
def move_file(originals, destination):
    
    for original in originals:
        if os.path.exists(original):
            shutil.move(original, destination)
1083396
void copyTo(final File destinationFolder) throws IOException {
    for (final File f : this.theFiles) {
      final File destinationFile = new File(destinationFolder, f.getName());
      Files.copy(f.toPath(), destinationFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
    }
  }
122096
public void moveFromLocalFile(Path src, Path dst)
    throws IOException {
    copyFromLocalFile(true, true, false, src, dst);
  }
474836
def copyfile(source, destination, force=True):
    '''
    '''
    if os.path.exists(destination) and force is True:
        os.remove(destination)
    shutil.copyfile(source, destination)
    return destination
1024158
def copy_file(self, src_path, file_name, key=None):
        
        path = os.path.join(self._directories[key], file_name)
        shutil.copyfile(src_path, path)
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)
266186
function copyFile(srcPath: string, destPath: string) {
  if (fs.lstatSync(srcPath).isDirectory()) {
    if (!fs.existsSync(destPath)) {
      fs.mkdirSync(destPath);
    }
    // Not recursive
    return;
  }

  return new Promise((resolve, reject) => {
    copyBinaryFile(srcPath, destPath, err => {
      if (err) {
        reject(err);
      }
      resolve(destPath);
    });
  });
}