Write the generated Document file to the destination directory.

 dest - The String path to the destination dir.

 Returns nothing.
197664
def write(dest)
      path = destination(dest)
      FileUtils.mkdir_p(File.dirname(path))
      File.write(path, output, :mode => "wb")

      trigger_hooks(:post_write)
    end
309323
private static function copy($src, $dest)
  {
    // If the destination directory does not exist create it
    if(!is_dir($dest)) {
      if(!mkdir($dest,0777,true)) {
        // If the destination directory could not be created stop processing
        echo "Can't create destination path: {$dest}\n";
        return false;
      }
    }
    copy($src, "$dest/" . basename($src));
  }
1334168
function zipDirectory(directories, dest, callback) {
        var archive = archiver.create('zip', {gzip: false});

        // Where to write the file
        var destStream = fs.createWriteStream(dest);

        archive.on('error', function(err) {
            this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Archiving failed', err));
        });

        archive.on('entry', function(file) {
            // do nothing
        });

        destStream.on('error', function(err) {
            this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'WriteStream failed', err));
        });

        destStream.on('close', function() {
            var size = archive.pointer();
            gutil.log(PLUGIN_NAME, gutil.colors.green('Created ' + dest + ' (' + size + ' bytes)'));
            callback();
        });

        archive.pipe(destStream);

        directories.forEach(function(directory) {
            if (fs.lstatSync(directory.src).isDirectory()) {
              archive.directory(directory.src, directory.dest);
            } else {
              this.emit('error', new gutil.PluginError(PLUGIN_NAME, directory.src + ' is not a valid directory'));
              return;
            }
        });

        archive.finalize();
    }
1283374
def write(path, doc, mode=MODE_TSV, **kwargs):
    '''  '''
    if mode == MODE_TSV:
        with TxtWriter.from_path(path) as writer:
            writer.write_doc(doc)
    elif mode == MODE_JSON:
        write_json(path, doc, **kwargs)
1077921
def destination(dest)
      dest = @site.in_dest_dir(dest)
      @site.in_dest_dir(dest, Jekyll::URL.unescape_path(url))
    end
192707
def write_files(template, destination='./dxf'):
    
    os.makedirs(destination)
    for key, value in template.items():
        with open(os.path.join(destination, key), 'w') as f:
            f.write(replace_whitespace(value, insert=False))
583394
def copyFile(src, dest):
    
    #Src Exists?
    try:
        if os.path.isfile(src):
            dpath, dfile = os.path.split(dest)

            if not os.path.isdir(dpath):
                os.makedirs(dpath)

            if not os.path.exists(dest):
                touch(dest)
            try:
                shutil.copy2(src, dest)
            # eg. src and dest are the same file
            except shutil.Error as e:
                logging.exception('Error: %s' % e)
            # eg. source or destination doesn't exist
            except IOError as e:
                logging.exception('Error: %s' % e.strerror)
    except:
        logging.exception('Error: src to copy does not exist.')
536668
function(srcpath, destpath, options) {
        // Destpath is optional.
        if (typeof destpath !== 'string') {
          options = destpath;
          destpath = srcpath;
        }
        // Ensure srcpath is absolute.
        if (!grunt.file.isPathAbsolute(srcpath)) {
          srcpath = init.srcpath(srcpath);
        }
        // Use placeholder file if no src exists.
        if (!srcpath) {
          srcpath = helpers.getFile('misc/placeholder');
        }
        grunt.verbose.or.write('Writing ' + destpath + '...');
        try {
          grunt.file.copy(srcpath, init.destpath(destpath), options);
          grunt.verbose.or.ok();
        } catch(e) {
          grunt.verbose.or.error().error(e);
          throw e;
        }
      }
409912
function(src, dest, transform) {
        if (typeof src !== 'string' || src.length === 0) {
            throw 'Invalid source file path (arg #1)';
        }
        if (typeof dest !== 'string' || dest.length === 0) {
            throw 'Invalid destination file path (arg #2)';
        }
        if (typeof transform !== 'function') {
            transform = function(data) {
                return data;
            };
        }

        var def = _promise.deferred();
        _fs.readFile(src, function(err, data) {
            if (err) {
                def.reject(err);
            } else {
                var data = transform(data.toString());
                _fs.writeFile(dest, data, function(err, data) {
                    if (err) {
                        def.reject(err);
                    } else {
                        def.resolve();
                    }
                });
            }
        });

        return def.promise();
    }
1079155
function(src, dest) {
    var contents,
        srcExists = fs.existsSync(src),
        destExists = fs.existsSync(dest),
        stats = srcExists && fs.statSync(src),
        isDirectory = srcExists && stats.isDirectory();

    if (srcExists) {
        if (isDirectory) {
            if (!destExists) {
                fs.mkdirSync(dest);
            }
            fs.readdirSync(src).forEach(function(childItemName) {
                copyRecursiveSync(path.join(src, childItemName),
                    path.join(dest, childItemName));
            });
        } else {
            contents = fs.readFileSync(src);
            fs.writeFileSync(dest, contents);
        }
    }
}
1160185
private File makeDestFile(URL src) {
        if (dest == null) {
            throw new IllegalArgumentException("Please provide a download destination");
        }

        File destFile = dest;
        if (destFile.isDirectory()) {
            //guess name from URL
            String name = src.toString();
            if (name.endsWith("/")) {
                name = name.substring(0, name.length() - 1);
            }
            name = name.substring(name.lastIndexOf('/') + 1);
            destFile = new File(dest, name);
        } else {
            //create destination directory
            File parent = destFile.getParentFile();
            if (parent != null) {
                parent.mkdirs();
            }
        }
        return destFile;
    }
424424
public static void copyFile(File dest, File source) throws IOException {
        InputStream input = null;
        try {
            input = new FileInputStream(source);
            createFile(dest, input);
        } finally {
            Utils.tryToClose(input);
        }
    }
513987
public static void fileCopy(final File src, final File dest, final boolean overwrite) throws IOException {
        if (!dest.exists() || (dest.exists() && overwrite)) {
            // Create parent directory structure if necessary
            FileUtils.mkParentDirs(dest);

            if (overwrite) {
                Files.copy(src.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
            } else {
                Files.copy(src.toPath(), dest.toPath());
            }
        }
    }
994016
def write_to_disk(filename, delete=False, content=get_time()):
    
    if not os.path.exists(os.path.dirname(filename)):
        return
    if delete:
        if os.path.lexists(filename):
            os.remove(filename)
    else:
        with open(filename, 'wb') as f:
            f.write(content.encode('utf-8'))
235163
def to_csv(self, dest:str)->None:
        ""
        self.to_df().to_csv(self.path/dest, index=False)
1181315
def _recursive_overwrite(self, src, dest):
        
        if os.path.isdir(src):
            if not os.path.isdir(dest):
                os.makedirs(dest)
            files = os.listdir(src)
            for f in files:
                self._recursive_overwrite(os.path.join(src, f),
                                          os.path.join(dest, f))
        else:
            shutil.copyfile(src, dest, follow_symlinks=False)
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)