Back to product page

RealPath function


Retrieves the real path for a symbolic link.

Type

A Long value. If successful, 0 is returned, otherwise error as specified here

Syntax

  • C
long Sftp_RealPath(void *Sftp, char *RemotePath);
The RealPath(void *Sftp,char *RemotePath) syntax has these parts:
void *SftpHandle of the created Sftp instance.
char *RemotePathFull path to a file for which you want to get information.

Remarks

UNIX operating systems (which are usually running SSH and SFTP servers) have something called 'a link' implemented in their file system. Windows has something similar called a 'shortcut'. These are files that point to another file or a directory and are created by regular users or administrators.

The RealPath method will send a request to a server to 'reveal' information about such a link file. For example, to determine if

/bin/sh

is really an executable file, or just a link to

/usr/local/bin/bash

(typically set on newer UNIXes), you could call this method. After the request completes on the server, the ListItems event will be fired, containing the real path of the file that /bin/sh points to. It could be /usr/local/bin/bash, it could be /bin/sh (if it is not a link at all) or could be something else.

Even if you do see a link file like this when you initiate the ListDir method (they are shown like this: /bin/sh -> /usr/local/bin/bash) , it is possible that this is hidden because some UNIX operating systems (such as Solaris SunOS) also support hard links in their file system. In which case you will not be aware of links using regular directory listings.

Platforms

Windows