Пример #1
0
 /**
  * @return \Icewind\SMB\IShare[]
  * @throws \Icewind\SMB\Exception\AuthenticationException
  * @throws \Icewind\SMB\Exception\InvalidHostException
  */
 public function listShares()
 {
     $this->connect();
     $shares = array();
     $dh = $this->state->opendir('smb://' . $this->getHost());
     while ($share = $this->state->readdir($dh)) {
         if ($share['type'] === 'file share') {
             $shares[] = $this->getShare($share['name']);
         }
     }
     $this->state->closedir($dh);
     return $shares;
 }
Пример #2
0
 /**
  * List the content of a remote folder
  *
  * @param string $path
  * @return \Icewind\SMB\IFileInfo[]
  *
  * @throws \Icewind\SMB\Exception\NotFoundException
  * @throws \Icewind\SMB\Exception\InvalidTypeException
  */
 public function dir($path)
 {
     $this->connect();
     $files = array();
     $dh = $this->state->opendir($this->buildUrl($path));
     while ($file = $this->state->readdir($dh)) {
         $name = $file['name'];
         if ($name !== '.' and $name !== '..') {
             $files[] = new NativeFileInfo($this, $path . '/' . $name, $name);
         }
     }
     $this->state->closedir($dh);
     return $files;
 }