RemotePath.TranslateRemotePathToLocal Method
Generates a local path equivalent of a remote path, given root paths.
Syntax
C#
public static string TranslateRemotePathToLocal( string remotePath, string remoteRoot, string localRoot )
VB.NET
Public Shared Function TranslateRemotePathToLocal( remotePath As String, remoteRoot As String, localRoot As String ) As String
Parameters
Name | Description |
---|---|
string remotePath | An absolute remote path to translate. |
string remoteRoot | An absolute path to a remote root folder that is an equivalent of the localRoot . |
string localRoot | An absolute path to a local root folder that is an equivalent of the remoteRoot . |
Return Value
A local path equivalent of the remote path.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | The remotePath is not within remoteRoot . |
ArgumentNullException | Some of the arguments is null . |
Remarks
Basically replaces remoteRoot
with localRoot
in remotePath
and converts all slashes (/
) to backslashes (\
).
It makes no difference if remoteRoot
and localRoot
end with slash (backslash) or not.
The method useful when enumerating remote files with Session.EnumerateRemoteFiles
.
For an opposite operation, see RemotePath.TranslateLocalPathToRemote
.