(AutoIt) SFTP SymLink - Create Symbolic Link on Server
Demonstrates how to create a symbolic link on the SFTP server.
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oSftp = ObjCreate("Chilkat.SFtp")
; Pass a domain or IP address..
Local $bSuccess = $oSftp.Connect("my-sftp-server.com",22)
If ($bSuccess = True) Then
$bSuccess = $oSftp.AuthenticatePw("mySFtpLogin","mySFtpPassword")
EndIf
If ($bSuccess = True) Then
$bSuccess = $oSftp.InitializeSftp()
EndIf
If ($bSuccess <> True) Then
ConsoleWrite($oSftp.LastErrorText & @CRLF)
Exit
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.
$bSuccess = $oSftp.SymLink("/etc/ssh/sshd_config","sshd_config")
If ($bSuccess <> True) Then
ConsoleWrite($oSftp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Successfully created symbolic link." & @CRLF)
|