RemotePath.TranslateLocalPathToRemote Method

Generates a remote path equivalent of a local path, given root paths.


public static string TranslateLocalPathToRemote(
    string localPath,
    string localRoot,
    string remoteRoot
Public Shared Function TranslateLocalPathToRemote(
    localPath As String,
    localRoot As String,
    remoteRoot As String
) As String


Name Description
string localPath An absolute local path to translate.
string localRoot An absolute path to a local root folder that is an equivalent of the remoteRoot.
string remoteRoot An absolute path to a remote root folder that is an equivalent of the localRoot.

Return Value

A remote path equivalent of the local path.


Exception Condition
InvalidOperationException The localPath is not within localRoot.
ArgumentNullException Some of the arguments is null.


Basically replaces localRoot with remoteRoot in localPath and converts all backslashes (\) to slashes (/).

It makes no difference if localRoot and remoteRoot end with slash (backslash) or not.

For an opposite operation, see RemotePath.TranslateRemotePathToLocal.


Real-Life Example

Last modified: by martin