ftp_pwd 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;
      }
      
return $ret;
    }

    /** * Gets the current working directory. * * @since 2.5.0 * * @return string|false The current working directory on success, false on failure. */
    public function cwd() {
        $cwd = ftp_pwd( $this->link );

        if ( $cwd ) {
            $cwd = trailingslashit( $cwd );
        }

        return $cwd;
    }

    /** * Changes current directory. * * @since 2.5.0 * * @param string $dir The new current directory. * @return bool True on success, false on failure. */
Home | Imprint | This part of the site doesn't use cookies.