Table of Contents

Method ExpandPathAsync

Namespace
SshSharp.Sftp
Assembly
SshSharp.dll

ExpandPathAsync(string, CancellationToken)

path with a leading ~ or ~user expanded and made canonical, as sftp does for cd ~/dir (expand-path@openssh.com, OpenSSH 8.7+). Without the extension, ~ and ~/... start at GetHomeDirectoryAsync(CancellationToken), and a path without a tilde resolves as GetFullPathAsync(string, CancellationToken) does.

public Task<string> ExpandPathAsync(string path, CancellationToken cancellationToken = default)

Parameters

path string
cancellationToken CancellationToken

Returns

Task<string>

Exceptions

NotSupportedException

The path starts with ~user and the server lacks expand-path@openssh.com.

SftpException

The path cannot be resolved, or the user is unknown.