Sample code for 30+ languages & platforms
Xbase++

SFTP SymLink - Create Symbolic Link on Server

See more SFTP Examples

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

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oSftp

nSuccess := 0

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

oSftp := CreateObject("Chilkat.SFtp")

//  Pass a domain or IP address..
nSuccess := oSftp:Connect("my-sftp-server.com", 22)
IF (nSuccess == 1)
    nSuccess := oSftp:AuthenticatePw("mySFtpLogin", "mySFtpPassword")
ENDIF

IF (nSuccess == 1)
    nSuccess := oSftp:InitializeSftp()
ENDIF

IF (nSuccess != 1)
    ? oSftp:LastErrorText
    oSftp:destroy()
    RETURN
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.
nSuccess := oSftp:SymLink("/etc/ssh/sshd_config", "sshd_config")
IF (nSuccess != 1)
    ? oSftp:LastErrorText
    oSftp:destroy()
    RETURN
ENDIF

? "Successfully created symbolic link."

oSftp:destroy()