Change working directory on server
963588
def cd(self, remote):
        
        try:
            self.conn.cwd(remote)
        except Exception:
            return False
        else:
            return self.pwd()
578233
public void setWorkingDirectory(File dir) {
        if (!dir.exists()) {
            throw new IllegalArgumentException(dir + " doesn't exist.");
        }
        pb.directory(dir);
    }
1131414
def _options_dir(name):
    '''
    
    '''
    _check_portname(name)
    _root = '/var/db/ports'

    # New path: /var/db/ports/category_portname
    new_dir = os.path.join(_root, name.replace('/', '_'))
    # Old path: /var/db/ports/portname
    old_dir = os.path.join(_root, name.split('/')[-1])

    if os.path.isdir(old_dir):
        return old_dir
    return new_dir
687976
function formatRepoUrl( dir ) {
	dir = path.resolve( dir );
	dir = dir.replace( /\\/g, '/' );
	return g_serverUser + '@127.0.0.1:' + dir;
	//return 'file:///' + dir;
}
402928
def set_working_dir(self, working_dir):
        

        # encase working_dir in quotes to protect spaces in the path
        yield from self.send('hypervisor working_dir "{}"'.format(working_dir))
        self._working_dir = working_dir
        log.debug("Working directory set to {}".format(self._working_dir))
640241
public void goUpDir() throws IOException, ServerException {
        try {
            controlChannel.execute(Command.CDUP);
            // alternative: changeDir("..");
        } catch (FTPReplyParseException rpe) {
            throw ServerException.embedFTPReplyParseException(rpe);
        } catch (UnexpectedReplyCodeException urce) {
            throw ServerException.embedUnexpectedReplyCodeException(
                                urce,
                                "Server refused changing current directory");
        }
    }
365238
def change_to_workdir(self):
        
        logger.info("Changing working directory to: %s", self.workdir)

        self.check_dir(self.workdir)
        try:
            os.chdir(self.workdir)
        except OSError as exp:
            self.exit_on_error("Error changing to working directory: %s. Error: %s. "
                               "Check the existence of %s and the %s/%s account "
                               "permissions on this directory."
                               % (self.workdir, str(exp), self.workdir, self.user, self.group),
                               exit_code=3)
        self.pre_log.append(("INFO", "Using working directory: %s" % os.path.abspath(self.workdir)))
903753
private void postWorkDirectory() {

        // Acquire (or calculate) the work directory path
        String workDir = getWorkDir();
        if (workDir == null || workDir.length() == 0) {

            // Retrieve our parent (normally a host) name
            String hostName = null;
            String engineName = null;
            String hostWorkDir = null;
            Container parentHost = getParent();
            if (parentHost != null) {
                hostName = parentHost.getName();
                if (parentHost instanceof StandardHost) {
                    hostWorkDir = ((StandardHost)parentHost).getWorkDir();
                }
                Container parentEngine = parentHost.getParent();
                if (parentEngine != null) {
                   engineName = parentEngine.getName();
                }
            }
            if ((hostName == null) || (hostName.length() < 1))
                hostName = "_";
            if ((engineName == null) || (engineName.length() < 1))
                engineName = "_";

            String temp = getBaseName();
            if (temp.startsWith("/"))
                temp = temp.substring(1);
            temp = temp.replace('/', '_');
            temp = temp.replace('\\', '_');
            if (temp.length() < 1)
                temp = ContextName.ROOT_NAME;
            if (hostWorkDir != null ) {
                workDir = hostWorkDir + File.separator + temp;
            } else {
                workDir = "work" + File.separator + engineName +
                    File.separator + hostName + File.separator + temp;
            }
            setWorkDir(workDir);
        }

        // Create this directory if necessary
        File dir = new File(workDir);
        if (!dir.isAbsolute()) {
            String catalinaHomePath = null;
            try {
                catalinaHomePath = getCatalinaBase().getCanonicalPath();
                dir = new File(catalinaHomePath, workDir);
            } catch (IOException e) {
                logger.warn(sm.getString("standardContext.workCreateException",
                        workDir, catalinaHomePath, getName()), e);
            }
        }
        if (!dir.mkdirs() && !dir.isDirectory()) {
            logger.warn(sm.getString("standardContext.workCreateFail", dir,
                    getName()));
        }

        // Set the appropriate servlet context attribute
        if (context == null) {
            getServletContext();
        }
        context.setAttribute(ServletContext.TEMPDIR, dir);
//        context.setAttributeReadOnly(ServletContext.TEMPDIR);
    }
1165757
def _remap_dirname(local, remote):
    
    def do(x):
        return x.replace(local, remote, 1)
    return do
375393
def set_server_dir(self, dir):
        
        self.dir = os.path.abspath(dir)
        config = os.path.join(self.dir, 'etc', 'grid', 'config.xml')
        self.configured = os.path.exists(config)
1290290
function(callback) {
            // Optional permission modification
            if (disablePerms) {
              callback();
              return;
            }
            
            grunt.verbose.writeln('changing file perms...');

            // 511 = 0777 octal
            ftpout.raw.site('chmod', (file.mode & 511).toString(8), file.dest, function(err) {
              // Windows and some hosts don't implement the CHMOD site extension
              if (err && err.code !== 502 && err.code !== 504) {
                done(err);
                return;
              }

              grunt.verbose.writeln('done changing perms');
              callback();
            });
          }
652266
def make_directory(self, directory_name, *args, **kwargs):
		
		self.dav_client().mkdir(self.join_path(self.session_path(), directory_name))
1152435
function(options){
        if (!options) {
            options = {
                cwd: workingDirectory
            };

            return options;
        } else {
            workingDirectory = options.cwd;
            return options;
        }
    }
530762
function mkdirpSync(folder) {
  if (!fs.existsSync(path.dirname(folder))) {
    mkdirpSync(path.dirname(folder));
  }

  if (!fs.existsSync(folder)) {
    fs.mkdirSync(folder, '0755');
  }
}
1315002
def set_paths(self, base_dir, script_path):
        """"""
        # Make absolute paths #
        if 'change_dir' in self.kwargs:
            self.kwargs['change_dir'] = DirectoryPath(os.path.abspath(self.kwargs['change_dir']))
        if 'out_file' in self.kwargs:
            self.kwargs['out_file']   = FilePath(os.path.abspath(self.kwargs['out_file']))
        # In case there is a base directory #
        if base_dir is not None:
            self.base_dir             = DirectoryPath(os.path.abspath(base_dir))
            self.script_path          = FilePath(base_dir + "run." + self.extensions[self.language])
            self.kwargs['change_dir'] = base_dir
            self.kwargs['out_file']   = FilePath(base_dir + "run.out")
        # Other cases #
        if base_dir is None and script_path is None: self.script_path = FilePath(new_temp_path())
        if script_path is not None: self.script_path = FilePath(os.path.abspath(script_path))
974990
def setup_dir(self):
        """"""
        cd = self.opts.cd or self.config['crony'].get('directory')
        if cd:
            self.logger.debug(f'Adding cd to {cd}')
            self.cmd = f'cd {cd} && {self.cmd}'
313621
def server_prepare_root_bin_dir():
    ''''''
    commands = ['run_backup']
    for command in commands:
        install_file_legacy(flo('/root/bin/{command}'), sudo=True)
        sudo(flo('chmod 755 /root/bin/{command}'))
        if command == 'run_backup':
            sudo('ln -snf /root/bin/run_backup /etc/cron.daily/run_backup')