diff options
author | Alex Crichton <alex@alexcrichton.com> | 2015-03-12 10:29:26 -0700 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-12 10:29:26 -0700 |
commit | dd88872bef65cca51741ebc64e84bb274d499119 (patch) | |
tree | 5bf48874e912905e0c5cba1255b4ed410f0d3f7a /src | |
parent | 850eee9fb1db9249527e171b5cb9cc09647174e6 (diff) | |
download | ssh2-rs-dd88872bef65cca51741ebc64e84bb274d499119.zip |
Bind unlink for SFTP files
Closes #11
Diffstat (limited to 'src')
-rw-r--r-- | src/sftp.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/sftp.rs b/src/sftp.rs index 009f7cf..869b665 100644 --- a/src/sftp.rs +++ b/src/sftp.rs @@ -299,6 +299,16 @@ impl<'sess> Sftp<'sess> { }) } + /// Remove a file on the remote filesystem + pub fn unlink(&self, file: &Path) -> Result<(), Error> { + let file = try!(util::path2bytes(file)); + self.rc(unsafe { + raw::libssh2_sftp_unlink_ex(self.raw, + file.as_ptr() as *const _, + file.len() as c_uint) + }) + } + /// Peel off the last error to happen on this SFTP instance. pub fn last_error(&self) -> Error { let code = unsafe { raw::libssh2_sftp_last_error(self.raw) }; |