Online Help
SFTP is an action plugin that can be used to connect to secure servers, and manage files over SSH.
SFTP.Connect
SFTP.ConnectPK
SFTP.Delete
SFTP.Disconnect
SFTP.Download
SFTP.Rename
SFTP.Upload
Connects to a SFTP server, using a login and password.
(string) The hostname or IP address of the FTP server to connect to.
(string) The account to be used on the FTP connection.
(string) The password to be used.
(number) The port to connect to. Defaults to 22 if not provided.
(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.
res = SFTP.Connect("192.168.0.14", "admin", "mysecret", 22);
if (res ~= 0) then
error = Application.GetLastError();
Dialog.Message("SFTP", "Could not open FTP connection. ("..error..")");
end
Connects to a SFTP server, using a login and file holding a private key in OpenSSH or PuTTY format.
(string) The hostname or IP address of the FTP server to connect to.
(string) The account to be used on the FTP connection.
(string) The path to the file holding a private key in OpenSSH or PuTTY format. The private key works as the password to the SFTP server account.
(string) The optional password to access the PPK. Leave blank ("") if there is no password for the accessing the private key.
(number) The port to connect to. Defaults to 22 if not provided.
(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.
res = SFTP.Connect("192.168.0.14", "testuser", "D:\\eSupport\\mykey.ppk", "mysecret", 22);
if (res ~= 0) then
error = Application.GetLastError();
Dialog.Message("SFTP", "Could not open FTP connection. ("..error..")");
end
The beginning of a PPK file with an encrypted private key would typically look like this:

Deletes one file on the remote FTP server.
(string) The file to be deleted on the FTP server.
(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.
-- this deletes a file inside a sub folder of the account's home path
res = SFTP.Delete("./subfolder/filename.ext");
if (res ~= 0) then
error = Application.GetLastError();
Dialog.Message("SFTP", "Could not delete the file. ("..error..")");
end
Closes an open connection to a remote secure FTP server gracefully.
(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.
-- finishes data exchange with remote server result = SFTP.Disconnect();
Downloads a file from a SFTP server.
(string) The name of the remote file to be downloaded.
(string) The name for the local file.
(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.
StatusDlg.Show();
StatusDlg.SetMessage("newfilename.exe");
SFTP.Download("newfilename.exe", "D:\\eSupport\\targetfile.exe");
error = Application.GetLastError();
if (error ~= 0) then
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
Application.Exit();
else
Dialog.Message("SFTP", "download ok");
end
This will show the DlgStatus with download progress:

Renames one file on the remote FTP server.
(string) The current filename of the file.
(string) The new filename of the file in the current directory on the FTP server.
(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.
res = SFTP.Rename("test.html", "newindex.html");
if (res ~= 0) then
error = Application.GetLastError();
Dialog.Message("SFTP", "Could not rename the file. ("..error..")");
end
Uploads a local file to the remote FTP server.
(string) The full path to the file to be uploaded.
(string) The name to be used for the remote file.
(number) 0 if success, 1 otherwise. You can use Application.GetLastError to determine whether this action failed, and why.
StatusDlg.Show();
StatusDlg.SetMessage("newfilename.exe");
SFTP.Upload("D:\\eSupport\\setup_x64.exe", "newfilename.exe");
error = Application.GetLastError();
if (error ~= 0) then
Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
Application.Exit();
else
Dialog.Message("SFTP", "upload ok");
end
This will show the DlgStatus with upload progress:

12020 - Failed to open SFTP Actions plugin.
12021 - Internal error.
12022 - Could not connect to SFTP server.
12023 - Could not initialize subsystem.
12024 - Not connected to SFTP server.
12025 - Could not read the private key.
12026 - Could not upload file.
12027 - Could not download file.
12028 - Could not delete file.
12029 - Could not rename file or folder.
Ulrich Peters
upeters@mindquake.com.br
Plugin is copyright © 2025 Ulrich Peters
Copyright © 2025 Ulrich Peters
Todos os direitos reservados.