Session.TranslateLocalPathToRemote Method

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

Syntax

C#
public string TranslateLocalPathToRemote(string localPath, string localRoot, string remoteRoot)
VB.NET
Public Function TranslateLocalPathToRemote(ByVal localPath As String, ByVal localRoot As String, ByVal remoteRoot As String) As String

Parameters

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.

Exceptions

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

Remarks

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 Session.TranslateRemotePathToLocal.

Examples

Real-Life Example

 
  library_session_translatelocalpathtoremote.txt · Last modified: by martin
 

Search Documentation

This page

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

Associations

Site design by Black Gate