Delete File from FTP Server
Verb: ftpDelete
Available from: <Standard>
Deletes a file from a server using the FTP or SFTP protocol.
The FTP and SFTP protocols make it possible to transfer files between computers via the network.
Syntax
ftpDelete --type(FtpType) --host(String) [--useanonymous(Boolean)] [--useprivatekeyauthentication(Boolean)] --sftpusername(String) [--ftpusername(String)] [--password(String)] --remotepath(String) --privatekeyfile(String) (Boolean)=value
Inputs
| Script | Designer | Required | AcceptedTypes | Description |
|---|---|---|---|---|
| --type | Type | Required | FtpType |
Type of protocol to be used:
FTP and SFTP transfer the file from one computer to another, however, FTP does not provide a secure channel for transferring files, while SFTP offers extra protection for files, for example, using the SSH (Secure Shell) security protocol. |
| --host | Server Path | Required | Text | Path of the server where the file is located. |
| --useanonymous | Anonymous connection | Optional | Boolean | When enabled, it hides the username, establishing an anonymous connection. |
| --useprivatekeyauthentication | Use private key authentication | Optional | Boolean | When enabled, it makes the field available to inform the path of the private key file. |
| --sftpusername | SFTP username | Only when Type is Sftp | Text | Username to access the server via SFTP. |
| --ftpusername | FTP username | Optional | Text | Username to access the server via FTP. |
| --password | Password | Optional | Text | User password to access the server via FTP. |
| --remotepath | Remote Path | Required | Text | Path of the file that should be deleted inside the server. |
| --privatekeyfile | Private key file | Only when Use private key authentication is True | Text | Path to the private key file. |
Outputs
| Script | Designer | AcceptedTypes | Description |
|---|---|---|---|
| value | Success | Boolean | Returns "True", if the file was deleted successfully, or "False", otherwise. |
Example
The command deletes a file from a server using the FTP protocol.
defVar --name success --type Boolean
ftpDelete --type "Ftp" --host hostAddress --username userName --password password --remotepath fileToDeletePath success=value
For this example to work properly, it is necessary to use a valid host, with valid username and password for access.