Getting absolute path of an object on an SFTP server
Ultimate Sftp class exposes the GetAbsolutePath method which is used to retrieve absolute path of a remote path. To use this method, simply pass the remote relative path you wish to process to the only one parameter of the method and it will return the absolute path.
The following steps guide you on how to use this method.
C#:
// Create a new instance.
Sftp client = new Sftp();
// Connect to the SFTP server.
client.Connect("localhost");
// Authenticate.
client.Authenticate("test", "test");
// ...
// Retrieve the absolute path of the path "testdir/test.dat".
string relativePath = "testdir/test.dat";
string absolutePath = client.GetAbsolutePath(relativePath);
Console.WriteLine("Absolute path of '{0}' is '{1}'", relativePath, absolutePath);
// ...
// Disconnect.
client.Disconnect();
VB.NET:
' Create a new instance.
Dim client As New Sftp()
' Connect to the SFTP server.
client.Connect("localhost")
' Authenticate.
client.Authenticate("test", "test")
' ...
' Retrieve the absolute path of the path "testdir/test.dat".
Dim relativePath As String = "testdir/test.dat"
Dim absolutePath As String = client.GetAbsolutePath(relativePath)
Console.WriteLine("Absolute path of '{0}' is '{1}'", relativePath, absolutePath)
' ...
' Disconnect.
client.Disconnect()