Create the hard link from src file to the dest file.
7228
public boolean hardLinkTo(String src, String dst) throws IOException {  
    INode dstNode = hardLinkToInternal(src, dst); 
    getEditLog().logSync(false);  
    if (dstNode != null && auditLog.isInfoEnabled()) {  
			logAuditEvent(getCurrentUGI(), Server.getRemoteIp(),
        "hardlink", src, dst, dstNode);
    } 
    return dstNode != null; 
  }
1193817
def from_file_url(url):
    
    if url.startswith('file://'):
        url = url[len('file://'):].replace('/', os.path.sep)

    return url
1255762
def _move_file_to_dest_dir(self, filename):
        ''''''
        assert self._params.move_to

        if os.path.isdir(self._params.move_to):
            _logger.debug('Moved {} to {}.', self._warc_filename,
                          self._params.move_to)
            shutil.move(filename, self._params.move_to)
        else:
            _logger.error('{} is not a directory; not moving {}.',
                          self._params.move_to, filename)
20522
def download_from_link(self, link, **kwargs):
        
        # old:new format
        old_arg_map = {'save_path': 'savepath'}  # , 'label': 'category'}

        # convert old option names to new option names
        options = kwargs.copy()
        for old_arg, new_arg in old_arg_map.items():
            if options.get(old_arg) and not options.get(new_arg):
                options[new_arg] = options[old_arg]

        if type(link) is list:
            options['urls'] = "\n".join(link)
        else:
            options['urls'] = link

        # workaround to send multipart/formdata request
        # http://stackoverflow.com/a/23131823/4726598
        dummy_file = {'_dummy': (None, '_dummy')}

        return self._post('command/download', data=options, files=dummy_file)
1050002
public boolean hardLink(String src, String dst) throws IOException {  
    checkOpen();  
    try { 
      return namenode.hardLink(src, dst); 
    } catch(RemoteException re) { 
      throw re.unwrapRemoteException(AccessControlException.class,  
                                     NSQuotaExceededException.class,  
                                     DSQuotaExceededException.class); 
    } 
  }
957630
function createDir(srcPath, desPath) {
    var pathInfo = path.parse(desPath);
    var searchvalue = pathInfo.root[pathInfo.root.length - 1]
    var start = 0;
    var found = pathInfo.dir.indexOf(searchvalue);
    var subPath = '';
    var dirs = [];

    if (found != -1) {
        while (true) {
            subPath = pathInfo.dir.substr(start, found - start + 1);
            if (subPath != '') {
                dirs.push(subPath);
            }
            start = found + 1;
            found = pathInfo.dir.indexOf(searchvalue, start);
            if (found == -1) {
                if (start < pathInfo.dir.length) {
                    dirs.push(pathInfo.dir.substr(start));
                }
                break;
            }
        }
    }

    subPath = '';
    dirs.forEach(function (dir, num) {
        subPath += dir;
        if (!fs.existsSync(subPath)) {
            try {
                fs.mkdirSync(subPath);
            } catch (e) {
                if (e.code != 'EEXIST') {
                    console.log('[error] ', e);
                };
            }
            console.log('[info] create  dir:', subPath);
        }
        if (num == dirs.length - 1 && pathInfo.base != '') {
            copyFile(srcPath, desPath);
            //console.log('src file:', srcPath);
            //console.log('des file:', desPath);
        }
    });

}
106349
def copy_file_tree(src: str,
                   dest: str,
                   ctx: Optional[Dict[str, Any]] = None,
                   option_locations: Optional[List[Tuple[str, List[str]]]] = None):
    
    if os.path.exists(dest):
        shutil.rmtree(dest, ignore_errors=True)
    shutil.copytree(src, dest)

    if option_locations:
        for option, paths in option_locations:
            for path in paths:
                path = os.path.join(dest, path)
                if os.path.isfile(path):
                    os.remove(path)
                else:
                    shutil.rmtree(path, ignore_errors=True)

    if 'app_bundle_module_name' in ctx:
        shutil.move(os.path.join(dest, 'app'),
                    os.path.join(dest, ctx['app_bundle_module_name']))
        shutil.move(os.path.join(dest, 'tests', 'app'),
                    os.path.join(dest, 'tests', ctx['app_bundle_module_name']))

    _render_file_tree(dest, ctx)
1074528
function makeFilePathRelativeToCwd (file) {
  const cwd = process.cwd();
  return (file.startsWith(cwd)) ? '.' + file.substring(cwd.length) : file;
}
604567
def copy_file_links(self, src):
        # type: (RockRidge) -> None
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Rock Ridge extension not yet initialized')

        # First, get the src data
        if src.dr_entries.px_record is None:
            if src.ce_entries.px_record is None:
                raise pycdlibexception.PyCdlibInvalidInput('No Rock Ridge file links')
            num_links = src.ce_entries.px_record.posix_file_links
        else:
            num_links = src.dr_entries.px_record.posix_file_links

        # Now apply it to this record.
        if self.dr_entries.px_record is None:
            if self.ce_entries.px_record is None:
                raise pycdlibexception.PyCdlibInvalidInput('No Rock Ridge file links')
            self.ce_entries.px_record.posix_file_links = num_links
        else:
            self.dr_entries.px_record.posix_file_links = num_links
1107144
def from_fs_path(path):
    """"""
    scheme = 'file'
    params, query, fragment = '', '', ''
    path, netloc = _normalize_win_path(path)
    return urlunparse((scheme, netloc, path, params, query, fragment))
728505
def prepare_synteny(tourfile, lastfile, odir, p, opts):
    
    qbedfile, sbedfile = get_bed_filenames(lastfile, p, opts)
    qbedfile = op.abspath(qbedfile)
    sbedfile = op.abspath(sbedfile)

    qbed = Bed(qbedfile, sorted=False)
    contig_to_beds = dict(qbed.sub_beds())

    # Create a separate directory for the subplots and movie
    mkdir(odir, overwrite=True)
    os.chdir(odir)
    logging.debug("Change into subdir `{}`".format(odir))

    # Make anchorsfile
    anchorsfile = ".".join(op.basename(lastfile).split(".", 2)[:2]) \
                  + ".anchors"
    fw = open(anchorsfile, "w")
    for b in Blast(lastfile):
        print("\t".join((gene_name(b.query), gene_name(b.subject),
                                str(int(b.score)))), file=fw)
    fw.close()

    # Symlink sbed
    symlink(sbedfile, op.basename(sbedfile))

    return anchorsfile, qbedfile, contig_to_beds
490230
def from_python_src(
        cls,
        pySrc,
        lambdas_path,
        json_filename: str,
        stem: str,
        save_file: bool = False,
    ):
        """"""
        asts = [ast.parse(pySrc)]
        pgm_dict = genPGM.create_pgm_dict(
            lambdas_path,
            asts,
            json_filename,
            {"FileName": f"{stem}.py"},  # HACK
        )
        lambdas = importlib.__import__(stem + "_lambdas")
        return cls.from_dict(pgm_dict, lambdas)
483880
@Override
  public boolean hardLink(Path src, Path dst) throws IOException {  
    return dfs.hardLink(getPathName(src), getPathName(dst));  
  }
52809
function (srcFiles, destPath) {
    // Iterate over all specified file groups.
    srcFiles.map(grunt.file.read).forEach(function (fileContent, i) {
        var abspath = srcFiles[i];
        var results = fileContent.match(applyminGlobal.beginminPattern_global);
        if (results) {
            var beginminInfo = {};
            for (var index in results) {
                var result = results[index].match(applyminGlobal.beginminPattern);
                var beginEndMinBlock = result[0];
                var targetUrlPath = result[1];
                var staticBlock = result[2];  // static block, maybe css/js
                var targetFilePath = targetUrlPath.match(new RegExp(destPath + '/' + '\\S+\\.(css|js)', 'i'));
                if (!targetFilePath) {
                    grunt.warn('In the file: ' + abspath + ', the target filename in ' + targetUrlPath + ' should start with ' + destPath + '/' + ' and end with .css or .js');
                }
                targetFilePath = targetFilePath[0];
                _handleStaticBlock(abspath, targetFilePath, staticBlock);
                if (targetFilePath in beginminInfo) {
                    grunt.warn('In the file: ' + abspath + ', the target filename ' + targetFilePath + ' should not be duplicated.');
                }
                beginminInfo[targetFilePath] = {targetUrlPath:targetUrlPath, beginEndMinBlock:beginEndMinBlock};
            }
            // Store results for the applymin later.
            applyminGlobal.beginminInfos[abspath] = beginminInfo;
        }
    });
  }
1186341
public static void copyFile(File src, File dest) throws IOException {

        if (src == null)
            throw new NullPointerException("Source must not be null");
        if (dest == null)
            throw new NullPointerException("Destination must not be null");
        if (!src.exists())
            throw new FileNotFoundException("Source '" + src + "' does not exist");
        if (!src.isFile())
            throw new IOException("Source '" + src + "' is not a file");
        if (dest.exists())
            throw new IOException("Destination '" + dest + "' is already exists");

        FileChannel in = null, out = null;
        try {
            in = new FileInputStream(src).getChannel();
            out = new FileOutputStream(dest).getChannel();

            in.transferTo(0, in.size(), out);
        } finally {
            try {
                in.close();
                out.close();
            } catch (IOException e) {
                // Ignore.
            }
        }

        if (src.length() != dest.length()) {
            throw new IOException("Failed to copy full contents from '" +
                src + "' to '" + dest + "'");
        }

        dest.setLastModified(src.lastModified());
    }
238727
def make
      src = @file
      dst = Tempfile.new([@basename, @format ? ".#{@format}" : ''])
      dst.binmode

      begin
        parameters = []
        parameters << source_file_options
        parameters << ":source"
        parameters << transformation_command
        parameters << convert_options
        parameters << ":dest"

        parameters = parameters.flatten.compact.join(" ").strip.squeeze(" ")

        success = Paperclip.run("convert", parameters, :source => "#{File.expand_path(src.path)}[0]", :dest => File.expand_path(dst.path))
      rescue PaperclipCommandLineError => e
        raise PaperclipError, "There was an error processing the thumbnail for #{@basename}" if @whiny
      end

      dst
    end
794535
def recursive_copy(src_dir, dest_dir):
  

  file_io.recursive_create_dir(dest_dir)
  for file_name in file_io.list_directory(src_dir):
    old_path = os.path.join(src_dir, file_name)
    new_path = os.path.join(dest_dir, file_name)

    if file_io.is_directory(old_path):
      recursive_copy(old_path, new_path)
    else:
      file_io.copy(old_path, new_path, overwrite=True)