Delphi DLL
Delphi DLL
SFTP SymLink - Create Symbolic Link on Server
See more SFTP Examples
Demonstrates how to create a symbolic link on the SFTP server.Chilkat Delphi DLL Downloads
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, SFtp;
...
procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
sftp: HCkSFtp;
begin
success := False;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
sftp := CkSFtp_Create();
// Pass a domain or IP address..
success := CkSFtp_Connect(sftp,'my-sftp-server.com',22);
if (success = True) then
begin
success := CkSFtp_AuthenticatePw(sftp,'mySFtpLogin','mySFtpPassword');
end;
if (success = True) then
begin
success := CkSFtp_InitializeSftp(sftp);
end;
if (success <> True) then
begin
Memo1.Lines.Add(CkSFtp__lastErrorText(sftp));
Exit;
end;
// 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.
success := CkSFtp_SymLink(sftp,'/etc/ssh/sshd_config','sshd_config');
if (success <> True) then
begin
Memo1.Lines.Add(CkSFtp__lastErrorText(sftp));
Exit;
end;
Memo1.Lines.Add('Successfully created symbolic link.');
CkSFtp_Dispose(sftp);
end;