Table of Contents

Class SftpFile

Namespace
Renci.SshNet.Sftp
Assembly
Renci.SshNet.dll

Represents SFTP file information.

public sealed class SftpFile : ISftpFile

Inheritance

Implements

Inherited Members

Properties

Attributes

Gets the file attributes.

public SftpFileAttributes Attributes { get; }

Property Value

SftpFileAttributes

FullName

Gets the full path of the file or directory.

public string FullName { get; }

Property Value

string

GroupCanExecute

Gets or sets a value indicating whether the group members can execute this file.

public bool GroupCanExecute { get; set; }

Property Value

bool

GroupCanRead

Gets or sets a value indicating whether the group members can read from this file.

public bool GroupCanRead { get; set; }

Property Value

bool

GroupCanWrite

Gets or sets a value indicating whether the group members can write into this file.

public bool GroupCanWrite { get; set; }

Property Value

bool

GroupId

Gets or sets file group id.

public int GroupId { get; set; }

Property Value

int

IsBlockDevice

Gets a value indicating whether file represents a block device.

public bool IsBlockDevice { get; }

Property Value

bool

IsCharacterDevice

Gets a value indicating whether file represents a character device.

public bool IsCharacterDevice { get; }

Property Value

bool

IsDirectory

Gets a value indicating whether file represents a directory.

public bool IsDirectory { get; }

Property Value

bool

IsNamedPipe

Gets a value indicating whether file represents a named pipe.

public bool IsNamedPipe { get; }

Property Value

bool

IsRegularFile

Gets a value indicating whether file represents a regular file.

public bool IsRegularFile { get; }

Property Value

bool

IsSocket

Gets a value indicating whether file represents a socket.

public bool IsSocket { get; }

Property Value

bool

Gets a value indicating whether file represents a symbolic link.

public bool IsSymbolicLink { get; }

Property Value

bool

LastAccessTime

Gets or sets the time the current file or directory was last accessed.

public DateTime LastAccessTime { get; set; }

Property Value

DateTime

LastAccessTimeUtc

Gets or sets the time, in coordinated universal time (UTC), the current file or directory was last accessed.

public DateTime LastAccessTimeUtc { get; set; }

Property Value

DateTime

LastWriteTime

Gets or sets the time when the current file or directory was last written to.

public DateTime LastWriteTime { get; set; }

Property Value

DateTime

LastWriteTimeUtc

Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.

public DateTime LastWriteTimeUtc { get; set; }

Property Value

DateTime

Length

Gets the size, in bytes, of the current file.

public long Length { get; }

Property Value

long

Name

Gets the name of the file or directory.

public string Name { get; }

Property Value

string

Remarks

For directories, this is the name of the last directory in the hierarchy if a hierarchy exists; otherwise, the name of the directory.

OthersCanExecute

Gets or sets a value indicating whether the others can execute this file.

public bool OthersCanExecute { get; set; }

Property Value

bool

OthersCanRead

Gets or sets a value indicating whether the others can read from this file.

public bool OthersCanRead { get; set; }

Property Value

bool

OthersCanWrite

Gets or sets a value indicating whether the others can write into this file.

public bool OthersCanWrite { get; set; }

Property Value

bool

OwnerCanExecute

Gets or sets a value indicating whether the owner can execute this file.

public bool OwnerCanExecute { get; set; }

Property Value

bool

OwnerCanRead

Gets or sets a value indicating whether the owner can read from this file.

public bool OwnerCanRead { get; set; }

Property Value

bool

OwnerCanWrite

Gets or sets a value indicating whether the owner can write into this file.

public bool OwnerCanWrite { get; set; }

Property Value

bool

UserId

Gets or sets file user id.

public int UserId { get; set; }

Property Value

int

Methods

Delete()

Permanently deletes a file on remote machine.

public void Delete()

DeleteAsync(CancellationToken)

Permanently deletes a file on the remote machine.

public Task DeleteAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The System.Threading.CancellationToken to observe.

Returns

Task

A System.Threading.Tasks.Task that represents the asynchronous delete operation.

MoveTo(string)

Moves a specified file to a new location on remote machine, providing the option to specify a new file name.

public void MoveTo(string destFileName)

Parameters

destFileName string

The path to move the file to, which can specify a different file name.

Exceptions

ArgumentNullException

destFileName is null.

SetPermissions(short)

Sets file permissions.

public void SetPermissions(short mode)

Parameters

mode short

The mode.

ToString()

Returns a System.String that represents this instance.

public override string ToString()

Returns

string

A System.String that represents this instance.

UpdateStatus()

Updates file status on the server.

public void UpdateStatus()