change working directory

@return FTPCLient
@throws IOException
@throws PageException
198461
private AFTPClient actionChangeDir() throws IOException, PageException {
	required("directory", directory);

	AFTPClient client = getClient();
	client.changeWorkingDirectory(directory);
	writeCfftp(client);
	return client;
    }
1055824
function onDirectory() {
      var this_SendStream = this;
      if (!/\/$/.test(reqUrl.pathname)) {
        // No trailing slash? Redirect to add one
        res.writeHead(301, {
          'Location': reqUrl.pathname + '/' + (reqUrl.search || '')
        });
        res.end();
        deferred.resolve(true);
        return;
      }

      var indexPath = path.normalize(path.join(
        self.$root, unescape(this.path), 'index.html'));

      fs.exists(indexPath, function(exists) {
        if (exists) {
          // index.html exists, just serve that. This is the same as
          // the below call except without onDirectory and without
          // .index(false)
          send(req, suffix, {root: self.$root})
            .on('error', onError)
            .on('stream', onStream)
            .pipe(res);
          deferred.resolve(true);
        } else {
          // Either serve up 404, or the directory auto-index
          if (!self.$dirIndex) {
            deferred.resolve(null);
          } else {
            deferred.resolve(
              self.$autoindex_p(req, res, this_SendStream.path, self.$blacklist)
            );
          }
        }
      });
    }
902913
private AFTPClient actionGetCurrentURL() throws PageException, IOException {
	AFTPClient client = getClient();
	String pwd = client.printWorkingDirectory();
	Struct cfftp = writeCfftp(client);
	cfftp.setEL("returnValue", client.getPrefix() + "://" + client.getRemoteAddress().getHostName() + pwd);
	return client;
    }
1306787
public function putAll($source_directory, $target_directory, $mode = FTP_BINARY)
    {
        $d = dir($source_directory);
        // do this for each file in the directory
        while ($file = $d->read()) {
            // to prevent an infinite loop
            if ($file != '.' && $file != '..') {
                // do the following if it is a directory
                if (is_dir($source_directory . '/' . $file)) {
                    if (!@$this->ftp->chdir($target_directory . '/' . $file)) {
                        // create directories that do not yet exist
                        $this->ftp->mkdir($target_directory . '/' . $file);
                    }
                    // recursive part
                    $this->putAll(
                        $source_directory . '/' . $file, $target_directory . '/' . $file,
                        $mode
                    );
                } else {
                    // put the files
                    $this->ftp->put(
                        $target_directory . '/' . $file, $source_directory . '/' . $file,
                        $mode
                    );
                }
            }
        }

        return $this;
    }
267439
private AFTPClient actionRemove() throws IOException, PageException {
	required("item", item);
	AFTPClient client = getClient();
	client.deleteFile(item);
	writeCfftp(client);

	return client;
    }
448000
private AFTPClient actionCreateDir() throws IOException, PageException {
	required("directory", directory);

	AFTPClient client = getClient();
	client.makeDirectory(directory);
	writeCfftp(client);
	return client;
    }
1234379
public function actionFolderRemove() {
		$source = $this->getSource();

		$file_path = false;

		$path = $source->getPath();

		$this->accessControl->checkPermission($this->getUserRole(), $this->action, $path);

		$target = $this->request->name;

		if (realpath($path . $target) && strpos(realpath($path . $target), $source->getRoot()) !== false) {
			$file_path = realpath($path . $target);
		}

		if ($file_path && file_exists($file_path)) {
			if (is_dir($file_path)) {
				$thumb = $file_path . Consts::DS . $source->thumbFolderName . Consts::DS;
				if (is_dir($thumb)) {
					Helper::deleteDir($thumb);
				}
				Helper::deleteDir($file_path);
			} else {
				throw new \Exception('It is not a directory!', Consts::ERROR_CODE_IS_NOT_WRITEBLE);
			}
		} else {
			throw new \Exception('Directory not exists', Consts::ERROR_CODE_NOT_EXISTS);
		}
	}
1024041
private function _directory()
    {
        if ($this->isSFTP()) {
            // == DIRECTORY_SEPARATOR ? '' : $pwd;
            $pwd = @$this->ftp->pwd();
        } else {
            $pwd = @ftp_pwd($this->ftp);
        }
        if (!$pwd) {
            $this->fail("couldn't get current directory");
        }
    }
1202511
static function changeFileData( &$mimeInfo, $dirpath = false, $basename = false, $suffix = false, $filename = false )
    {
        if ( $basename !== false )
            $mimeInfo['basename'] = $basename;
        if ( $suffix !== false )
            $mimeInfo['suffix'] = $suffix;
        if ( $filename !== false )
        {
            $mimeInfo['filename'] = $filename;
        }
        else
        {
            $mimeInfo['filename'] = $mimeInfo['basename'];
            $mimeInfo['filename'] .= '.' . $mimeInfo['suffix'];
        }
        if ( $dirpath !== false )
            $mimeInfo['dirpath'] = $dirpath;

        if ( $mimeInfo['dirpath'] )
            $mimeInfo['url'] = $mimeInfo['dirpath'] . '/' . $mimeInfo['filename'];
        else
            $mimeInfo['url'] = $mimeInfo['filename'];
    }
472199
@Override
    protected Smb2QueryDirectoryResponse createResponse ( CIFSContext tc, ServerMessageBlock2Request<Smb2QueryDirectoryResponse> req ) {
        return new Smb2QueryDirectoryResponse(tc.getConfig(), this.fileInformationClass);
    }
496438
public function buildProxyOrNot()
    {
        if (!Util::existsDirWritable(INITIALLY_RPC_ROOT_PATH)) {
            throw new InitiallyRpcException("rpc framework root dir not to be write");
        }

        if ($this->compareConfigFile()) {
            $services = $this->config->getServices();
            foreach ($services as $service) {
                $this->builder->create($service->getInterface());
            }
        }
    }
379648
public function actionFolderCreate() {
		$source = $this->getSource();
		$destinationPath = $source->getPath();

		$this->accessControl->checkPermission($this->getUserRole(), $this->action, $destinationPath);

		$folderName = Helper::makeSafe($this->request->name);

		if ($destinationPath) {
			if ($folderName) {
				if (!realpath($destinationPath . $folderName)) {
					mkdir($destinationPath . $folderName, $source->defaultPermission);
					if (is_dir($destinationPath . $folderName)) {
						return ['messages' => ['Directory successfully created']];
					}
					throw new \Exception('Directory was not created', Consts::ERROR_CODE_NOT_EXISTS);
				}
				throw new \Exception('Directory already exists', Consts::ERROR_CODE_NOT_ACCEPTABLE);
			}
			throw new \Exception('The name for new directory has not been set', Consts::ERROR_CODE_NOT_ACCEPTABLE);
		}
		throw new \Exception('The destination directory has not been set', Consts::ERROR_CODE_NOT_ACCEPTABLE);
	}
172084
public static void move(String srcPath, String dstPath) throws IOException {
    Files.move(Paths.get(srcPath), Paths.get(dstPath), StandardCopyOption.REPLACE_EXISTING);
  }
1138540
public void setWorkingDirectory(Path dir) throws IOException {
    ensureState(JobState.DEFINE);
    conf.setWorkingDirectory(dir);
  }
261534
public function mkdir($path)
	{
		// If native FTP support is enabled let's use it...
		if (FTP_NATIVE)
		{
			if (@ftp_mkdir($this->conn, $path) === false)
			{
				throw new FilesystemException(__METHOD__ . 'Bad response.');
			}

			return true;
		}

		// Send change directory command and verify success
		if (!$this->_putCmd('MKD ' . $path, 257))
		{
			throw new FilesystemException(
				sprintf('%1$s: Bad response.  Server response: %2$s [Expected: 257].  Path sent: %3$s', __METHOD__, $this->response, $path)
			);
		}

		return true;
	}
380598
function ftpProcessLocation(inPath, cb) {
    if (!toTransfer[inPath]) {
      cb(new Error('Data for ' + inPath + ' not found'));
    }
    ftpCwd('/' + remoteRoot + '/' + inPath.replace(/\\/gi, '/'), function(err) {
      var files;

      if (err) {
        grunt.warn('Could not switch to remote folder!');
      }

      currPath = inPath;
      files = toTransfer[inPath];
      async.forEach(files, ftpPut, function(err) {
        if (err) {
          grunt.warn('Failed uploading files!');
        }
        cb(null);
      });
    });
  }
673178
@Override
	public boolean cd(String directory) {
		boolean flag = true;
		try {
			flag = client.changeWorkingDirectory(directory);
		} catch (IOException e) {
			throw new FtpException(e);
		}
		return flag;
	}