FTP Delete
Allows to delete files on a FTP/SFTP server.
Json
Example
json
{
"name": "protocol-ftp-delete",
"taskReferenceName": "ftp_delete",
"description": "The business description of the task",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"connection": "SFTP",
"host": "",
"username": "",
"password": "",
"port": 21,
"mode": "FILES",
"files": ["file.txt", "file2.txt"]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
json
{
"name": "protocol-ftp-delete",
"taskReferenceName": "ftp_delete",
"description": "The business description of the task",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"connection": "SFTP",
"host": "",
"username": "",
"password": "",
"port": 21,
"mode": "REQUEST",
"request": "file://assets/request.xml"
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Definition
| Property | Type | Required | Description |
|---|---|---|---|
| The name (or type) of the task | |||
| The unique name of the task in your job. It is used to reference this task in the workflow. | |||
| The functional description of this task in your job. | |||
The type of the task. It must be SUB_WORKFLOW. | |||
| : | true: the job continues if there is an error on this task. false: the job fails. | ||
| Input parameters of the task. See below |
Inputs
| Property | Type | Required | Description |
|---|---|---|---|
| : | The protocol. Must be FTP or SFTP or FTPS. | ||
| : | Default: PASSWORDIf connection is not SFTP and authenticationMethod is PUBLIC_KEY, the task fails. | ||
| You can use a dns or an IP address. | |||
| The private key It is required to use a secret variable to store the private key. | |||
| optional | The private key passphrase, only taken into account if authenticationMethod=PUBLIC_KEY. Leave it out for a key that has none. | ||
If connection is no SFTP, if connection is SFTP and password is set then an invalid input error is added | |||
| : | FILE: the input file will be deleted.FILES: all the files in the input files will be deleted. REQUEST: the files will be deleted as defined in the request input. | ||
| The list of files to delete. Glob patterns are supported here. See glob patterns for more details. | |||
| A file that defines which files must be deleted and where. See the definition below. | |||
| : | Default: falseWhen set to true, the report generation is skipped and thus the report is not available in the output parameters. | ||
| : | Default: info It defines the log level to be recorded in the report. error < warning < info < debug |
TIP
The supported private keys are the following :
---- BEGIN SSH2 PUBLIC KEY ---------BEGIN RSA PRIVATE KEY----------BEGIN DSA PRIVATE KEY----------BEGIN EC PRIVATE KEY-----PuTTY-User-Key-File-2: (ssh-rsa)PuTTY-User-Key-File-2: (ssh-dss)-----BEGIN OPENSSH PRIVATE KEY-----
Input request
Example
xml
<Ftp-Delete>
<File>
<Path>/products-1.csv</Path>
</File>
<File>
<Path>/sub-folder/products-2.csv</Path>
</File>
</Ftp-Delete>1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Definition
| XPath | Description | Occurs |
|---|---|---|
| Ftp-Delete | Root of the document | 1 |
| ./File | For each file. | 1 |
| ./File/Path | The path of the file to delete. Must start with /. Glob patterns are supported - see below. | 1 |
Glob patterns are accepted here and in the files input, but they apply to the file name only. The path is split at its last /: what precedes it is the folder to look in, what follows it is matched as a glob against the names of the files in that folder.
That folder is not browsed recursively, so /exports/*.csv deletes every CSV directly under /exports, while /exports/**/*.csv does not reach into sub-folders. A pattern that matches nothing is reported as a DELETE_FAILED entry naming the pattern itself.
Outputs
| Property | Type | Description |
|---|---|---|
YES | NO. YES: every targeted file was deleted. NO: at least one deletion failed. | ||
| An XML file giving the deletion status of each targeted file. It is produced even when the task fails. |
Output listing
One Log per file the task attempted, plus the mode and target it was given:
xml
<Report task="protocol-ftp-delete">
<Input type="REQUEST">https://app.product-live.com/files-data-factory/1234...abcd</Input>
<Log type="DELETE_SUCCESS">
<Metadata>/exports/products-1.csv</Metadata>
</Log>
<Log type="DELETE_FAILED">
<Metadata>/exports/products-2.csv</Metadata>
</Log>
</Report>1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
| XPath | Description | Occurs |
|---|---|---|
Report | Root of the document | 1 |
Report@task | Always protocol-ftp-delete | 1 |
Report/Input | The target the task was given: the request url, or the files list | 1 |
Report/Input@type | The mode used | 1 |
Report/Log | One per file the task attempted | 0..* |
Report/Log@type | DELETE_SUCCESS or DELETE_FAILED | 1 |
Report/Log/Metadata | The full path of the file concerned | 1 |
When the task could not attempt anything at all - a failed connection, for instance - the document holds a single Log of type error, carrying the error code in a code attribute and the message in Metadata, instead of the per-file entries.
Limits and additional notes
The limitation of files that can be deleted is 100 (it can depends on file size).
In addition to these limitations, the following practices are recommended:
Always limit the number of files on a FTP folder
Supported SFTP ciphers
When connection = SFTP, the server must negotiate one of the following ciphers:
aes256-cbc, aes192-cbc, aes128-cbc, aes128-gcm, aes256-gcm, blowfish-cbc, 3des-cbc, cast128-cbc, arcfour, arcfour128, arcfour256.
A server that offers none of them cannot be reached: the connection fails during the SSH handshake, which is reported as a connection error rather than an authentication error.