SFTP Path Syntax

The SFTP protocol does not specify how absolute paths should be formatted.  For example, suppose your SFTP server runs on a Windows system and you wish to open (on the remote server) “C:\Temp\someFile.txt”.   Passing the exact string “C:\Temp\someFile.txt” to OpenFile will likely result in failure.  Different SSH/SFTP servers may expect different path conventions.  To discover what your SFTP server expects, call the Chilkat SFTP RealPath method with the arguments “.”, “”  as shown below:

// Your programming language syntax may be different.
string strPath = sftpObject.RealPath(".","");

Here is one example of what is returned:

/C/Documents and Settings/test123

Therefore, for this SFTP server if you wish to open “C:\Temp\someFile.txt”, the string you would pass to OpenFile is:

“/C/Temp/someFile.txt”

Here are example programs that call RealPath:
ASP: SFTP Using RealPath
SQL Server: SFTP Using RealPath
C#: SFTP Using RealPath
C++: SFTP Using RealPath
MFC: SFTP Using RealPath
C: SFTP Using RealPath
Delphi: SFTP Using RealPath
Visual FoxPro: SFTP Using RealPath
Java: SFTP Using RealPath
Perl: SFTP Using RealPath
PHP: SFTP Using RealPath
Python: SFTP Using RealPath
Ruby: SFTP Using RealPath
VB.NET: SFTP Using RealPath
Visual Basic: SFTP Using RealPath
VBScript: SFTP Using RealPath

Tags :