Copy input files out of the global file store and update location and
    path.
351530
def toilStageFiles(file_store, cwljob, outdir, index, existing, export,
                   destBucket=None):
    """"""

    def _collectDirEntries(obj):
    # type: (Union[Dict[Text, Any], List[Dict[Text, Any]]]) -> Iterator[Dict[Text, Any]]
        if isinstance(obj, dict):
            if obj.get("class") in ("File", "Directory"):
                yield obj
            else:
                for sub_obj in obj.values():
                    for dir_entry in _collectDirEntries(sub_obj):
                        yield dir_entry
        elif isinstance(obj, list):
            for sub_obj in obj:
                for dir_entry in _collectDirEntries(sub_obj):
                    yield dir_entry

    jobfiles = list(_collectDirEntries(cwljob))
    pm = ToilPathMapper(
        jobfiles, "", outdir, separateDirs=False, stage_listing=True)
    for f, p in pm.items():
        if not p.staged:
            continue

        # Deal with bucket exports
        if destBucket:
            # Directories don't need to be created if we're exporting to
            # a bucket
            if p.type == "File":
                # Remove the staging directory from the filepath and
                # form the destination URL
                unstageTargetPath = p.target[len(outdir):]
                destUrl = '/'.join(s.strip('/')
                                   for s in [destBucket, unstageTargetPath])

                file_store.exportFile(p.resolved[7:], destUrl)

            continue

        if not os.path.exists(os.path.dirname(p.target)):
            os.makedirs(os.path.dirname(p.target), 0o0755)
        if p.type == "File":
            file_store.exportFile(p.resolved[7:], "file://" + p.target)
        elif p.type == "Directory" and not os.path.exists(p.target):
            os.makedirs(p.target, 0o0755)
        elif p.type == "CreateFile":
            with open(p.target, "wb") as n:
                n.write(p.resolved.encode("utf-8"))

    def _check_adjust(f):
        f["location"] = schema_salad.ref_resolver.file_uri(
            pm.mapper(f["location"])[1])
        if "contents" in f:
            del f["contents"]
        return f

    visit_class(cwljob, ("File", "Directory"), _check_adjust)
971676
def rewrite_input_paths(self):
        
        for local_path, remote_path in self.file_renames.items():
            self.job_inputs.rewrite_paths(local_path, remote_path)
880993
def _map_scratch_files(self, file_dict):
        """"""
        if self._file_stage is None:
            return ({}, {})
        input_files = file_dict.input_files_to_stage
        output_files = file_dict.output_files_to_stage
        input_file_mapping = self._file_stage.map_files(input_files)
        output_file_mapping = self._file_stage.map_files(output_files)
        self._update_file_args(input_file_mapping)
        self._update_file_args(output_file_mapping)
        return input_file_mapping, output_file_mapping
853598
private void copyFromLocal(Path srcDir, Path dst) throws IOException {
    long partSize = conf.getLong(HAR_PARTSIZE_LABEL, HAR_PARTSIZE_DEFAULT);
    
    FileSystem srcFS = FileSystem.getLocal(conf);
    int partId = 0;
    FSDataOutputStream partStream = null;
    
    // index entries will be sorted by hash
    TreeMap<Integer, String> indexEntries = new TreeMap<Integer, String>();
    Queue<LocalAndArchivePaths> queue = new LinkedList<LocalAndArchivePaths>();
 
    try {
      queue.add(new LocalAndArchivePaths(srcDir, Path.SEPARATOR));
      while (!queue.isEmpty()) {
        LocalAndArchivePaths item = queue.remove();
        Path localPath = item.getLocalPath();
        String archiveItem = item.getArchivePath();

        FileStatus currenPathFileStatus = srcFS.getFileStatus(localPath);

        StringBuilder toWrite = new StringBuilder(
            URLEncoder.encode(item.getArchivePath().toString(), "UTF-8"));

        String properties = new HarProperties(currenPathFileStatus).serialize();

        if (currenPathFileStatus.isDir()) {
          FileStatus chlids[] = srcFS.listStatus(localPath);
          toWrite.append(" dir ");
          toWrite.append(properties);
          toWrite.append(" 0 0");
          for (FileStatus child : chlids) {
            Path childPath = child.getPath();
            String nextArchiveItem = new Path(archiveItem, childPath.getName()).toString(); 
            queue.add(new LocalAndArchivePaths(childPath, nextArchiveItem));
            toWrite.append(" ");
            toWrite.append(URLEncoder.encode(childPath.getName().toString(), "UTF-8"));
          }
          toWrite.append("\n");
        } else {
          if (partStream == null) {
            partStream = createNewPartStream(dst, partId);
          }

          toWrite.append(" file ");
          toWrite.append("part-" + partId);
          toWrite.append(" ");
          toWrite.append(partStream.getPos() + " " + currenPathFileStatus.getLen());
          toWrite.append(" " + properties);
          toWrite.append("\n");

          InputStream input = srcFS.open(localPath);
          IOUtils.copyBytes(input, partStream, conf, false);

          // proceed to next part
          if (partStream.getPos() >= partSize) {
            ++partId;
            partStream.close();
            partStream = null;
          }
        }
        int hash = HarFileSystem.getHarHash(archiveItem);
        indexEntries.put(new Integer(hash), toWrite.toString());
      }
    } finally {
      if (partStream != null) {
        partStream.close();
      }
    }

    // Now create master index
    // IndexEntries are already sorted by hash
    Path index = new Path(dst, HarFileSystem.INDEX_NAME);
    Path masterIndex = new Path(dst, HarFileSystem.MASTER_INDEX_NAME);
    
    FSDataOutputStream indexStream = null;
    FSDataOutputStream masterIndexStream = null;
    
    try {
      FileSystem dstFS = index.getFileSystem(conf);
      indexStream = dstFS.create(index);
      masterIndexStream = dstFS.create(masterIndex);
      String version = VERSION + "\n";
      masterIndexStream.write(version.getBytes());

      int startHash = 0;
      int endHash = 0;
      long indexStartPos = 0;
      long indexEndPos = 0;
      long numLines = 0;
      for (Map.Entry<Integer, String> indexEntry : indexEntries.entrySet()) {
        if (numLines == 0) {
          startHash = indexEntry.getKey();
          indexStartPos = indexStream.getPos();
        }
        endHash = indexEntry.getKey();
        indexStream.write(indexEntry.getValue().getBytes());
        ++numLines;
        if (numLines >= HadoopArchives.NUM_LINES_IN_BLOCK_INDEX) {
          numLines = 0;
          indexEndPos = indexStream.getPos();
          writeLineToMasterIndex(masterIndexStream, startHash, endHash, indexStartPos, indexEndPos);
        }
      }

      if (numLines > 0) {
        numLines = 0;
        indexEndPos = indexStream.getPos();
        writeLineToMasterIndex(masterIndexStream, startHash, endHash, indexStartPos, indexEndPos);
      }

    } finally {
      if (indexStream != null) {
        indexStream.close();
      }

      if (masterIndexStream != null) {
        masterIndexStream.close();
      }
    }
  }
10766
private void copyLibraryRecursive(Path input, Path output) throws IOException {
        for (Path dirItem : Files.list(input).collect(Collectors.toList())) {
            Path outputName = output.resolve(dirItem.getFileName());
            if (Files.isDirectory(dirItem)) {
                if(!Files.exists(outputName)) Files.createDirectory(outputName);
                copyLibraryRecursive(dirItem, outputName);
            } else {
                Files.copy(dirItem, outputName, StandardCopyOption.REPLACE_EXISTING);
            }
        }
    }
738826
public void copyToLocalFile(Path src, Path dst, boolean copyCrc)
    throws IOException {
    if (!fs.isDirectory(src)) { // source is a file
      fs.copyToLocalFile(src, dst);
      FileSystem localFs = getLocal(getConf()).getRawFileSystem();
      if (localFs.isDirectory(dst)) {
        dst = new Path(dst, src.getName());
      }
      dst = getChecksumFile(dst);
      if (localFs.exists(dst)) { //remove old local checksum file
        localFs.delete(dst, true);
      }
      Path checksumFile = getChecksumFile(src);
      if (copyCrc && fs.exists(checksumFile)) { //copy checksum file
        fs.copyToLocalFile(checksumFile, dst);
      }
    } else {
      FileStatus[] srcs = listStatus(src);
      for (FileStatus srcFile : srcs) {
        copyToLocalFile(srcFile.getPath(), 
                        new Path(dst, srcFile.getPath().getName()), copyCrc);
      }
    }
  }
776533
def move_file(originals, destination):
    
    for original in originals:
        if os.path.exists(original):
            shutil.move(original, destination)
283487
function copySchemaFiles() {
    const resolvedSrcSchemaPaths = path.resolve(rootDir, srcSchemaPaths);

    glob(resolvedSrcSchemaPaths, void(0), function(error, files) {
        files.forEach((filePath) => {
        const destSchemaPath = filePath.replace(/(\bsrc\b)(?!.*\1)/, destDir);
            fs.copyFileSync(filePath, destSchemaPath);
        });
    });
}
93552
def copy(srcpath, dstpath, overwrite=True):
    """"""
    # Handle bail conditions.
    if not op.exists(srcpath):
        return False
    if not overwrite:
        if op.isfile(dstpath):
            return False
        if op.isdir(dstpath):
            chkpath = op.join(dstpath, op.basename(srcpath))
            if op.isdir(chkpath) or op.isfile(chkpath):
                return False
    srcpath = op.abspath(srcpath)
    dstpath = op.abspath(dstpath)

    # Handle copying.
    if op.isdir(srcpath):
        dstdir = dstpath
        if op.isfile(dstpath):
            dstdir = op.dirname(dstpath)
        elif op.isdir(dstpath):
            # Make sure srcdir is copied INTO dstdir.
            dstdir = op.join(dstpath, op.basename(srcpath))
        makedirs(dstdir)
        for r,ds,fs in os.walk(srcpath):
            basedir = r.replace(srcpath, "").rstrip(os.sep).strip(os.sep)
            curdir = op.join(dstdir, basedir)
            makedirs(curdir)
            for f in fs:
                if not copy(op.join(r,f), op.join(curdir, f), overwrite=overwrite):
                    return False
    elif op.isfile(srcpath):
        makedirs(dstpath)
        shutil.copy2(srcpath, dstpath)

    return op.exists(dstpath)
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)
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
  }
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)
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);
    }
  }
400489
def copy_current_file_offset():
    """"""
    start, end = sark.get_selection()

    try:
        file_offset = sark.core.get_fileregion_offset(start)
        clipboard.copy("0x{:08X}".format(file_offset))

    except sark.exceptions.NoFileOffset:
        message("The current address cannot be mapped to a valid offset of the input file.")
1195947
def put(self, source, rel_path, metadata=None):
        '''

        '''

        # This case should probably be deprecated.
        if not isinstance(rel_path, basestring):
            rel_path = rel_path.cache_key

        sink = self.put_stream(rel_path, metadata=metadata)

        try:
            copy_file_or_flo(source, sink)
        except (KeyboardInterrupt, SystemExit):
            path_ = self.path(rel_path)
            if os.path.exists(path_):
                os.remove(path_)
            raise

        sink.close()

        return os.path.join(self.cache_dir, rel_path)
722252
def copy(location):
	""""""
	copyData = settings.getDataFile()
	copyFileLocation = os.path.abspath(location)
	copy = {"copyLocation": copyFileLocation}
	dataFile = open(copyData, "wb")
	pickle.dump(copy, dataFile)
	speech.speak(location + " copied successfully!")
	speech.speak("Tip: use 'hallie paste' to paste this file.")
1054050
def copySrcToOutputFile(srcFile, outFile, makeBackup)
      if makeBackup
        makeBackupFile(outFile)
      end
      FileUtils.cp(srcFile, outFile, :verbose => true)
    end