/** * @return \SMBBundle\SMB\IShare[] * @throws \SMBBundle\SMB\Exception\AuthenticationException * @throws \SMBBundle\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; }
/** * List the content of a remote folder * * @param string $path * @return \SMBBundle\SMB\IFileInfo[] * * @throws \SMBBundle\SMB\Exception\NotFoundException * @throws \SMBBundle\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; }