Session.TranslateRemotePathToLocal Method

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

Syntax

C#
public string TranslateRemotePathToLocal(string remotePath, string remoteRoot, string localRoot)
VB.NET
Public Function TranslateRemotePathToLocal(ByVal remotePath As String, ByVal remoteRoot As String, ByVal 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 Session.TranslateLocalPathToRemote.

Examples

Real-Life Example

 
  library_session_translateremotepathtolocal.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