Copies source string into the destination location.

        Parameters
        ----------
        source: string
            the string with the content to copy
        dest: string
            the s3 location
429927
def cp_string(self, source, dest, **kwargs):
        

        assert isinstance(source, six.string_types), "source must be a string"
        assert self._is_s3(dest), "Destination must be s3 location"

        return self._put_string(source, dest, **kwargs)
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
32122
def move(self, source, dest):
        

        source = self._item_path(source)
        dest = self._item_path(dest)

        # Check that source exists.
        if not (contains_array(self._store, source) or
                contains_group(self._store, source)):
            raise ValueError('The source, "%s", does not exist.' % source)
        if contains_array(self._store, dest) or contains_group(self._store, dest):
            raise ValueError('The dest, "%s", already exists.' % dest)

        # Ensure groups needed for `dest` exist.
        if "/" in dest:
            self.require_group("/" + dest.rsplit("/", 1)[0])

        self._write_op(self._move_nosync, source, dest)
1290748
public void copy(
      JimfsPath source,
      FileSystemView destView,
      JimfsPath dest,
      Set<CopyOption> options,
      boolean move)
      throws IOException {
    checkNotNull(source);
    checkNotNull(destView);
    checkNotNull(dest);
    checkNotNull(options);

    boolean sameFileSystem = isSameFileSystem(destView);

    File sourceFile;
    File copyFile = null; // non-null after block completes iff source file was copied
    lockBoth(store.writeLock(), destView.store.writeLock());
    try {
      DirectoryEntry sourceEntry = lookUp(source, options).requireExists(source);
      DirectoryEntry destEntry = destView.lookUp(dest, Options.NOFOLLOW_LINKS);

      Directory sourceParent = sourceEntry.directory();
      sourceFile = sourceEntry.file();

      Directory destParent = destEntry.directory();

      if (move && sourceFile.isDirectory()) {
        if (sameFileSystem) {
          checkMovable(sourceFile, source);
          checkNotAncestor(sourceFile, destParent, destView);
        } else {
          // move to another file system is accomplished by copy-then-delete, so the source file
          // must be deletable to be moved
          checkDeletable(sourceFile, DeleteMode.ANY, source);
        }
      }

      if (destEntry.exists()) {
        if (destEntry.file().equals(sourceFile)) {
          return;
        } else if (options.contains(REPLACE_EXISTING)) {
          destView.delete(destEntry, DeleteMode.ANY, dest);
        } else {
          throw new FileAlreadyExistsException(dest.toString());
        }
      }

      if (move && sameFileSystem) {
        // Real move on the same file system.
        sourceParent.unlink(source.name());
        sourceParent.updateModifiedTime();

        destParent.link(dest.name(), sourceFile);
        destParent.updateModifiedTime();
      } else {
        // Doing a copy OR a move to a different file system, which must be implemented by copy and
        // delete.

        // By default, don't copy attributes.
        AttributeCopyOption attributeCopyOption = AttributeCopyOption.NONE;
        if (move) {
          // Copy only the basic attributes of the file to the other file system, as it may not
          // support all the attribute views that this file system does. This also matches the
          // behavior of moving a file to a foreign file system with a different
          // FileSystemProvider.
          attributeCopyOption = AttributeCopyOption.BASIC;
        } else if (options.contains(COPY_ATTRIBUTES)) {
          // As with move, if we're copying the file to a different file system, only copy its
          // basic attributes.
          attributeCopyOption =
              sameFileSystem ? AttributeCopyOption.ALL : AttributeCopyOption.BASIC;
        }

        // Copy the file, but don't copy its content while we're holding the file store locks.
        copyFile = destView.store.copyWithoutContent(sourceFile, attributeCopyOption);
        destParent.link(dest.name(), copyFile);
        destParent.updateModifiedTime();

        // In order for the copy to be atomic (not strictly necessary, but seems preferable since
        // we can) lock both source and copy files before leaving the file store locks. This
        // ensures that users cannot observe the copy's content until the content has been copied.
        // This also marks the source file as opened, preventing its content from being deleted
        // until after it's copied if the source file itself is deleted in the next step.
        lockSourceAndCopy(sourceFile, copyFile);

        if (move) {
          // It should not be possible for delete to throw an exception here, because we already
          // checked that the file was deletable above.
          delete(sourceEntry, DeleteMode.ANY, source);
        }
      }
    } finally {
      destView.store.writeLock().unlock();
      store.writeLock().unlock();
    }

    if (copyFile != null) {
      // Copy the content. This is done outside the above block to minimize the time spent holding
      // file store locks, since copying the content of a regular file could take a (relatively)
      // long time. If done inside the above block, copying using Files.copy can be slower than
      // copying with an InputStream and an OutputStream if many files are being copied on
      // different threads.
      try {
        sourceFile.copyContentTo(copyFile);
      } finally {
        // Unlock the files, allowing the content of the copy to be observed by the user. This also
        // closes the source file, allowing its content to be deleted if it was deleted.
        unlockSourceAndCopy(sourceFile, copyFile);
      }
    }
  }
436901
public static void copyBackRouteHeader(byte[] source, byte[] dest) {
        int thisPointCode = getFromSif_DPC(source, 1);
        int remotePointCode = getFromSif_OPC(source, 1);
        int sls = getFromSif_SLS(source, 1);
        int si = getFromSif_SI(source);
        int ssi = getFromSif_SSI(source);
        writeRoutingLabel(dest, si, ssi, sls, remotePointCode, thisPointCode);
    }
761652
def _bind_sources_to_destination(self):
        # type: (SyncCopy) ->
        #        Tuple[blobxfer.models.azure.StorageEntity,
        #        blobxfer.models.azure.StorageEntity]
        
        seen = set()
        # iterate through source paths to download
        for src in self._spec.sources:
            for src_ase in src.files(
                    self._creds, self._spec.options,
                    self._general_options.dry_run):
                # generate copy destinations for source
                dest = [
                    dst_ase for dst_ase in
                    self._generate_destination_for_source(src_ase)
                ]
                if len(dest) == 0:
                    continue
                primary_dst = dest[0]
                uid = blobxfer.operations.synccopy.SyncCopy.create_deletion_id(
                    primary_dst._client, primary_dst.container,
                    primary_dst.name)
                if uid in seen:
                    raise RuntimeError(
                        'duplicate destination entity detected: {}/{}'.format(
                            primary_dst._client.primary_endpoint,
                            primary_dst.path))
                seen.add(uid)
                # add to exclusion set
                if self._spec.options.delete_extraneous_destination:
                    self._delete_exclude.add(uid)
                if len(dest[1:]) > 0:
                    if primary_dst.replica_targets is None:
                        primary_dst.replica_targets = []
                    primary_dst.replica_targets.extend(dest[1:])
                    # check replica targets for duplicates
                    for rt in primary_dst.replica_targets:
                        ruid = (
                            blobxfer.operations.synccopy.SyncCopy.
                            create_deletion_id(
                                rt._client, rt.container, rt.name)
                        )
                        if ruid in seen:
                            raise RuntimeError(
                                ('duplicate destination entity detected: '
                                 '{}/{}').format(
                                     rt._client.primary_endpoint, rt.path))
                        seen.add(ruid)
                        # add replica targets to deletion exclusion set
                        if self._spec.options.delete_extraneous_destination:
                            self._delete_exclude.add(ruid)
                yield src_ase, primary_dst
30129
def copy(self, path, dest, raise_if_exists=False):
        
        if raise_if_exists and dest in self.get_all_data():
            raise RuntimeError('Destination exists: %s' % path)
        contents = self.get_all_data()[path]
        self.get_all_data()[dest] = contents
897851
public static File copyFile(String src, String dest, StandardCopyOption... options) throws IORuntimeException {
		Assert.notBlank(src, "Source File path is blank !");
		Assert.notNull(src, "Destination File path is null !");
		return copyFile(Paths.get(src), Paths.get(dest), options).toFile();
	}
1069293
def _copy_content(self, origin, dstPath):
        

        if hasattr(origin, 'read'):
            copy_content(origin, dstPath, self.BLOCK_SIZE, self._conf['fmode'])
        elif os.path.isfile(origin):
            with open(origin, 'rb') as f:
                copy_content(f, dstPath, self.BLOCK_SIZE, self._conf['fmode'])
        else:
            raise ValueError("Could not copy content, `origin` should be a path or a readable object")
322349
def add_source(self, source):
        
        geocode_service = self._get_service_by_name(source[0])
        self._sources.append(geocode_service(**source[1]))
513667
function copy(source) {
    var destination;
    if (Type.isDate(source)) {
        return new Date(source.getTime());
    } else if (Type.isRegExp(source)) {
        return new RegExp(source.source);
    } else if (isConstructor(source)) {
        try {
            destination = new source.constructor;
            Object.keys(source).forEach(function (key) {
                destination[key] = copy(source[key]);
            });
            return destination;
        } catch (e) {
            throw new Error('Core.copy: To many recursions on copy', e);
        }
    }
    return source;
}
7975
function copy(source, destination, callback) {
  cp(source, destination, {overwrite: true}, function done(err) {
    if (err) callback(err)
    else callback()
  })
}
1062954
public static File copyFile(String source, String target) throws IOException {
        FileChannel inputChannel = null;
        FileChannel outputChannel = null;
        try {
            inputChannel = new FileInputStream(source).getChannel();
            outputChannel = new FileOutputStream(target).getChannel();
            outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
        } finally {
            if (inputChannel != null) {
                inputChannel.close();
            }
            if (outputChannel != null) {
                outputChannel.close();
            }
        }
        return new File(target);
    }
377823
def clone_source_dir(source_dir, dest_dir):
    
    if os.path.isdir(dest_dir):
        print('removing', dest_dir)
        shutil.rmtree(dest_dir)
    shutil.copytree(source_dir, dest_dir)
1364057
def copy(tree, source_filename):
    
    #_, ext = os.path.splitext(source_filename)
    filehash = sha1()
    with printer.progress(os.path.getsize(source_filename)) as update:
        with open(source_filename, 'rb') as fsource:
            with NamedTemporaryFile(dir=os.path.join(tree, '.kolekto', 'movies'), delete=False) as fdestination:
                # Copy the source into the temporary destination:
                while True:
                    buf = fsource.read(10 * 1024)
                    if not buf:
                        break
                    filehash.update(buf)
                    fdestination.write(buf)
                    update(len(buf))
                # Rename the file to its final name or raise an error if
                # the file already exists:
                dest = os.path.join(tree, '.kolekto', 'movies', filehash.hexdigest())
                if os.path.exists(dest):
                    raise IOError('This file already exists in tree (%s)' % filehash.hexdigest())
                else:
                    os.rename(fdestination.name, dest)
    return filehash.hexdigest()
839796
def copy_on_s3(self, src_file_name, dst_file_name, bucket_name):
        
        try:
            self.s3_client.head_bucket(Bucket=bucket_name)
        except botocore.exceptions.ClientError as e:  # pragma: no cover
            # If a client error is thrown, then check that it was a 404 error.
            # If it was a 404 error, then the bucket does not exist.
            error_code = int(e.response['Error']['Code'])
            if error_code == 404:
                return False

        copy_src = {
            "Bucket": bucket_name,
            "Key": src_file_name
        }
        try:
            self.s3_client.copy(
                CopySource=copy_src,
                Bucket=bucket_name,
                Key=dst_file_name
            )
            return True
        except botocore.exceptions.ClientError:  # pragma: no cover
            return False
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);
		}
	}