Usage: copy/cp <from> <to> - \
copy a file / dir remotely at Baidu Yun
  from - source path (file / dir)
  to - destination path (file / dir)
516829
def copy(self, fromp, to):
		''' 
		'''
		frompp = get_pcs_path(fromp)
		top = get_pcs_path(to)
		pars = {
			'method' : 'copy',
			'from' : frompp,
			'to' : top }

		self.pd("Remote copying '{}' =cc=> '{}'".format(frompp, top))
		return self.__post(pcsurl + 'file', pars, self.__copy_act)
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),
      );
    }),
  );
}
633102
def copy_file(src, target):
    
    LOGGER.info("Copying {} to {}".format(src, target))
    shutil.copyfile(src, target)
    shutil.copymode(src, target)
809391
def copy_file(file_name):
	

	remote_file_path = join(join(expanduser('~'), OCTOGRID_DIRECTORY), file_name)
	current_path = join(getcwd(), file_name)

	try:
		copyfile(remote_file_path, current_path)
	except Exception, e:
		raise e
7975
function copy(source, destination, callback) {
  cp(source, destination, {overwrite: true}, function done(err) {
    if (err) callback(err)
    else callback()
  })
}
57933
function copyFile(source, target) {
    var deferred,
        rd,
        wr;

    if (typeof fs.copyFile === 'function') {
        return Q.ninvoke(fs, 'copyFile', source, target);
    }

    deferred = Q.defer();

    rd = fs.createReadStream(source);
    wr = fs.createWriteStream(target);

    rd.on('error', function (err) {
        deferred.reject(err);
    });

    wr.on('error', function (err) {
        deferred.reject(err);
    });
    wr.on('close', function () {
        deferred.resolve();
    });

    rd.pipe(wr);

    return deferred.promise;
}
1282363
function mcFile(type, source, target, cb) {

	var targetDir,
	    bin,
	    cmd;

	if (type == 'cp' || type == 'copy') {
		bin = '/bin/cp';
	} else if (type == 'mv' || type == 'move') {
		bin = '/bin/mv';
	}

	// We assume the last piece of the target is the file name
	// Split the string by slashes
	targetDir = target.split('/');

	// Remove the last piece
	targetDir.splice(targetDir.length-1, 1);

	// Join it again
	targetDir = targetDir.join('/');

	// Make sure the target directory exists
	alchemy.createDir(targetDir, function ensuredDir(err) {

		if (err) {
			return cb(err);
		}

		spawnQueue.add(function queuecp(done) {

			var options = [];

			if (process.platform == 'linux') {
				options = ['--no-target-directory', source, target];
			} else {
				if (source.endsWith('/')) {
					source = source.slice(0, -1);
				}

				if (target.endsWith('/')) {
					target = target.slice(0, -1);
				}

				options = [source, target];
			}

			cmd = child.execFile(bin, options);

			cmd.on('exit', function onExit(code, signal) {

				var message;

				done();

				if (code > 0) {
					message = 'File "' + type + '" operation failed:\n';
					message += bin + ' ' + options.join(' ');

					cb(new Error(message));
				} else {
					cb(null);
				}
			});
		});
	});
}
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)
293337
function copyFile(srcPath, destPath) {
        let srcFileInfo = path.parse(srcPath) || {};
        if (!path.extname(destPath) && srcFileInfo.ext) {
            // destination is a directory!
            return copyFileIntoDirectory(srcPath, destPath);
        } else {
            return new Promise(function (resolve, reject) {
                fs.copy(srcPath, destPath, function (err) {
                    if (!err) {
                        resolve();
                    } else {
                        reject(err);
                    }
                });
            });
        }
    }
1248965
function copyFile (src, done) {
        var dest = path.join(outdir, path.relative(compiler.dirname, src))
        var dirname = utils.dirname(dest)

        if (dirname === dest) {
          copy(src, dest, compiler.dirname, done)
        } else {
          mkdirp(dirname, function (err) {
            if (err) return done(err)
            copy(src, dest, compiler.dirname, done)
          })
        }
      }
929175
def copy_file_from_master(
        remote_path,
        file_path='.',
        username=None,
        key_path=None
):
    

    return copy_file(shakedown.master_ip(), file_path, remote_path, username, key_path, 'get')
785804
def copy_submission_locally(self, cloud_path):
    
    local_path = os.path.join(self.download_dir, os.path.basename(cloud_path))
    cmd = ['gsutil', 'cp', cloud_path, local_path]
    if subprocess.call(cmd) != 0:
      logging.error('Can\'t copy submission locally')
      return None
    return local_path
1046554
function copyFile (fname, dirname, cb) {
    target.name = path.join(dirname, path.basename(file.name) )
    try {
      var readStream = fs.createReadStream(file.name)
        , writeStream = fs.createWriteStream(target.name, { mode: file.mode })
      readStream.pipe(writeStream)
      readStream.on('end', function () {
        cb(null, fname)
      })
    } catch (err) {
      return cb(err) // Could add more info
    }
  }
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)
500279
def copy(path, options = {}, &block)
      perform_request Net::HTTP::Copy, path, options, &block
    end
1090009
def pushPath_copy(self, d_msg, **kwargs):
        

        # Parse "header" information
        d_meta              = d_msg['meta']
        d_local             = d_meta['local']
        str_localPath       = d_local['path']
        d_remote            = d_meta['remote']
        d_transport         = d_meta['transport']
        d_copy              = d_transport['copy']

        # Pull the actual data into a dictionary holder
        d_curl                      = {
                                        'remoteServer': self.push_core(d_msg),
                                        'copy': {}
                                       }
        d_curl['copy']['status']    = d_curl['remoteServer']['status']
        if not d_curl['copy']['status']:
            d_curl['copy']['msg']   = "Copy on remote server failed!"
        else:
            d_curl['copy']['msg']   = "Copy on remote server success!"

        return d_curl
972915
def copy(source, destination):
    
    source = os.path.abspath(source)
    destination = os.path.abspath(destination)
    if source != destination:
        if not os.path.exists(os.path.dirname(destination)):
            os.makedirs(os.path.dirname(destination))
        shutil.copyfile(source, destination)