Sample code for 30+ languages & platforms
Rust

SFTP SymLink - Create Symbolic Link on Server

See more SFTP Examples

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

Chilkat Rust Downloads

Rust
let mut success = false;

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

let sftp = chilkat::SFtp::new();

// Pass a domain or IP address..
success = sftp.connect("my-sftp-server.com", 22).is_ok();
if success {
    success = sftp.authenticate_pw("mySFtpLogin", "mySFtpPassword").is_ok();
}

if success {
    success = sftp.initialize_sftp().is_ok();
}

if !success {
    println!("{}", sftp.last_error_text());
    return;
}

// 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.
if sftp.sym_link("/etc/ssh/sshd_config", "sshd_config").is_err() {
    println!("{}", sftp.last_error_text());
    return;
}

println!("Successfully created symbolic link.");