pub struct Sftp { /* private fields */ }
Implementations§
Source§impl Sftp
impl Sftp
Sourcepub fn create_dir(&self, filename: &str, mode: mode_t) -> SshResult<()>
pub fn create_dir(&self, filename: &str, mode: mode_t) -> SshResult<()>
Create a directory.
mode
specifies the permission bits to use on the directory.
They will be modified by the effective umask on the server.
Sourcepub fn canonicalize(&self, filename: &str) -> SshResult<String>
pub fn canonicalize(&self, filename: &str) -> SshResult<String>
Canonicalize filename
, resolving relative directory references
and symlinks.
Sourcepub fn chmod(&self, filename: &str, mode: mode_t) -> SshResult<()>
pub fn chmod(&self, filename: &str, mode: mode_t) -> SshResult<()>
Change the permissions of a file
Sourcepub fn chown(&self, filename: &str, owner: uid_t, group: gid_t) -> SshResult<()>
pub fn chown(&self, filename: &str, owner: uid_t, group: gid_t) -> SshResult<()>
Change the ownership of a file.
Sourcepub fn set_metadata(
&self,
filename: &str,
metadata: &SetAttributes,
) -> SshResult<()>
pub fn set_metadata( &self, filename: &str, metadata: &SetAttributes, ) -> SshResult<()>
Change certain metadata attributes of the named file.
Sourcepub fn metadata(&self, filename: &str) -> SshResult<Metadata>
pub fn metadata(&self, filename: &str) -> SshResult<Metadata>
Retrieve metadata for a file, traversing symlinks
Sourcepub fn symlink_metadata(&self, filename: &str) -> SshResult<Metadata>
pub fn symlink_metadata(&self, filename: &str) -> SshResult<Metadata>
Retrieve metadata for a file, without traversing symlinks.
Sourcepub fn rename(&self, filename: &str, new_name: &str) -> SshResult<()>
pub fn rename(&self, filename: &str, new_name: &str) -> SshResult<()>
Rename a file from filename
to new_name
Sourcepub fn remove_file(&self, filename: &str) -> SshResult<()>
pub fn remove_file(&self, filename: &str) -> SshResult<()>
Remove a file or an empty directory
Sourcepub fn remove_dir(&self, filename: &str) -> SshResult<()>
pub fn remove_dir(&self, filename: &str) -> SshResult<()>
Remove an empty directory
Sourcepub fn symlink(&self, target: &str, dest: &str) -> SshResult<()>
pub fn symlink(&self, target: &str, dest: &str) -> SshResult<()>
Create a symlink on the server.
target
is the filename of the symlink to be created,
and dest
is the payload of the symlink.
Sourcepub fn open(
&self,
filename: &str,
accesstype: OpenFlags,
mode: mode_t,
) -> SshResult<SftpFile>
pub fn open( &self, filename: &str, accesstype: OpenFlags, mode: mode_t, ) -> SshResult<SftpFile>
Open a file on the server.
accesstype
corresponds to the open(2)
flags
parameter
and controls whether the file is opened for read/write and so on.
mode
specified the permission bits to use when creating a new file;
they will be modified by the effective umask on the server side.