}
/**
+ * Returns if a given file or folder exists in a folder.
+ *
+ * @param string $path The path to the folder.
+ * @param string $name The file or folder name.
+ *
+ * @return boolean True if it exists, false otherwise.
+ */
+ function exists($path, $name)
+ {
+ $conn = $this->_connect();
+ if (is_a($conn, 'PEAR_Error')) {
+ return $conn;
+ }
+
+ return !(ssh2_sftp_stat($this->_sftp, ssh2_sftp_realpath($this->_sftp, $path) . '/' . $name) === false);
+ }
+
+ /**
* Returns a sorted list of folders in the specified directory.
*
* @param string $path The path of the directory to get the
{
return 'ssh2.sftp://' . $this->_params['username'] . ':' .
$this->_params['password'] . '@' . $this->_params['hostspec'] .
- ':' . $this->_params['port'] . $remote;
+ ':' . $this->_params['port'] .
+ ssh2_sftp_realpath($this->_sftp, $remote);
}
}