pwd() public method

Returns the current directory name
public pwd ( ) : mixed
return mixed
 /**
  * {@inheritdoc}
  */
 public function getWorkingDirectory()
 {
     if ($this->isConnected()) {
         return $this->connection->pwd();
     }
     return false;
 }
Example #2
0
 /**
  * @param null|string $Name
  *
  * @return SFTP\Directory[]|SFTP\File[]
  */
 public function listDirectory($Name = null)
 {
     $this->persistConnection();
     if (null === $Name) {
         $Name = $this->Connection->pwd();
     }
     $List = $this->Connection->rawlist($Name);
     $Return = array();
     foreach ($List as $Item => $Attributes) {
         if ($this->Connection->is_dir($Item)) {
             $Return[$Item] = new Directory($this, $Attributes);
         }
         if ($this->Connection->is_file($Item)) {
             $Return[$Item] = new File($this, $Attributes);
         }
     }
     return $Return;
 }
Example #3
0
 /**
  * Creates a symlink on the remote server
  *
  * @param $src
  * @param $dest
  * @throws \RuntimeException
  * @return mixed
  */
 public function symlink($src, $dest)
 {
     if (false === $this->isConnected()) {
         $this->connectAndLogin();
     }
     $this->dispatcher->dispatch(TransporterEvents::TRANSPORTER_SYMLINK, new TransporterEvent($this, array('dest' => $dest, 'src' => $src)));
     // make src an absolute path
     if (0 !== strpos($src, '/')) {
         $src = $this->sftp->pwd() . '/' . $src;
     }
     // strip end slashes
     $src = rtrim($src, '/');
     $dest = rtrim($dest, '/');
     $success = $this->sftp->exec(sprintf("ln -s -T -f %s %s", escapeshellarg($src), escapeshellarg($dest)));
     if (false === $success) {
         throw new \RuntimeException('Something went wrong: ' . "\n" . implode("\n", (array) $this->sftp->getErrors()));
     }
 }
Example #4
0
 /**
  * Get directory path.
  *
  * @return string
  *
  * @api
  */
 public function getPwd() : string
 {
     return $this->netSftp->pwd();
 }