ftp_chdir example

protected function createDirectoryJailed($directory) {
    if (!ftp_mkdir($this->connection, $directory)) {
      throw new FileTransferException("Cannot create directory @directory", 0, ["@directory" => $directory]);
    }
  }

  /** * {@inheritdoc} */
  protected function removeDirectoryJailed($directory) {
    $pwd = ftp_pwd($this->connection);
    if (!ftp_chdir($this->connection, $directory)) {
      throw new FileTransferException("Unable to change the current directory to @directory", 0, ['@directory' => $directory]);
    }
    $list = @ftp_nlist($this->connection, '.');
    if (!$list) {
      $list = [];
    }
    foreach ($list as $item) {
      if ($item == '.' || $item == '..') {
        continue;
      }
      if (@ftp_chdir($this->connection, $item)) {
        


    /** * Changes current directory. * * @since 2.5.0 * * @param string $dir The new current directory. * @return bool True on success, false on failure. */
    public function chdir( $dir ) {
        return @ftp_chdir( $this->link, $dir );
    }

    /** * Changes filesystem permissions. * * @since 2.5.0 * * @param string $file Path to the file. * @param int|false $mode Optional. The permissions as octal number, usually 0644 for files, * 0755 for directories. Default false. * @param bool $recursive Optional. If set to true, changes file permissions recursively. * Default false. * @return bool True on success, false on failure. */
Home | Imprint | This part of the site doesn't use cookies.