Sample code for 30+ languages & platforms
Visual FoxPro

SFTP SymLink - Create Symbolic Link on Server

See more SFTP Examples

Demonstrates how to create a symbolic link on the SFTP server.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loSftp

lnSuccess = 0

* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

loSftp = CreateObject('Chilkat.SFtp')

* Pass a domain or IP address..
lnSuccess = loSftp.Connect("my-sftp-server.com",22)
IF (lnSuccess = 1) THEN
    lnSuccess = loSftp.AuthenticatePw("mySFtpLogin","mySFtpPassword")
ENDIF

IF (lnSuccess = 1) THEN
    lnSuccess = loSftp.InitializeSftp()
ENDIF

IF (lnSuccess <> 1) THEN
    ? loSftp.LastErrorText
    RELEASE loSftp
    CANCEL
ENDIF

* Create a symbolic link on the server.
* We'll create a link in our HOME directory named "sshd_config"
* which points to the file /etc/ssh/sshd_config.
lnSuccess = loSftp.SymLink("/etc/ssh/sshd_config","sshd_config")
IF (lnSuccess <> 1) THEN
    ? loSftp.LastErrorText
    RELEASE loSftp
    CANCEL
ENDIF

? "Successfully created symbolic link."

RELEASE loSftp