Renci.SshNet.SftpClient.SetAttributes C# (CSharp) Method

SetAttributes() public method

Sets the specified SftpFileAttributes of the file on the specified path.
is null. Client is not connected. The method was called after the client was disposed.
public SetAttributes ( string path, SftpFileAttributes fileAttributes ) : void
path string The path to the file.
fileAttributes SftpFileAttributes The desired .
return void
        public void SetAttributes(string path, SftpFileAttributes fileAttributes)
        {
            CheckDisposed();

            if (_sftpSession == null)
                throw new SshConnectionException("Client not connected.");

            var fullPath = _sftpSession.GetCanonicalPath(path);

            _sftpSession.RequestSetStat(fullPath, fileAttributes);
        }

Usage Example

Beispiel #1
0
        public override void SetModifiedTime(SyncQueueItem i, DateTime time)
        {
            var attr = _sftpc.GetAttributes(i.CommonPath);

            attr.LastWriteTime = time;
            _sftpc.SetAttributes(i.CommonPath, attr);
        }