Short Description |
Ports |
Metadata |
DeleteFiles Attributes |
Details |
Examples |
See also |
DeleteFiles can be used to delete files and directories (also recursively).
Note | |
---|---|
To be able to use this component, you need a separate jobflow license. |
Component | Inputs | Outputs | Auto-propagated metadata |
---|---|---|---|
DeleteFiles | 0-1 | 0-2 |
Port type | Number | Required | Description | Metadata |
---|---|---|---|---|
Input | 0 | Input data records to be mapped to component attributes. | Any | |
Output | 0 | Results | Any | |
1 | Errors | Any |
DeleteFiles does not propagate metadata from left to right or from right to left.
This component has metadata templates. See Details for details on DeleteFiles metadata templates or see Metadata Templates for general info on metadata templates.
Attribute | Req | Description | Possible values |
---|---|---|---|
Basic | |||
File URL | yes [1] | Path to the file or directory to be deleted (see Supported URL Formats for File Operations). | |
Recursive | no | Delete directories recursively. | false (default) | true |
Input mapping | [2] | Defines mapping of input records to component attributes. | |
Output mapping | [2] | Defines mapping of results to standard output port. | |
Error mapping | [2] | Defines mapping of errors to error output port. | |
Redirect error output | no | If enabled, errors will be sent to the standard output port instead of the error port. | false (default) | true |
Verbose output | no | If enabled, one input record may cause multiple records to be sent to the output (e.g. as a result of wildcard expansion). Otherwise, each input record will yield just one cumulative output record. | false (default) | true |
Advanced | |||
Stop processing on fail | no |
By default, a failure causes the component to skip all subsequent input records and send the information about skipped input files to the error output port. This behaviour can be turned off by this attribute. False: If error occurs (e.g. file cannot be found), the component will continue in deleting of subsequent files. True: If error occurs, the component will stop deleting of subsequent files and will send the information about skipped operations to the error port. | true (default) | false |
[1] The attribute is required, unless specified in the Input mapping. [2] Required if the corresponding edge is connected. |
Editing any of the Input, Output or Error mapping opens the Transform Editor.
The editor allows you to override selected attributes of the component with the values of the input fields.
Field Name | Attribute | Type | Possible values |
---|---|---|---|
fileURL | File URL | string | |
recursive | Recursive | boolean | true | false |
The editor allows you to map the results and the input data to the output port.
If output mapping is empty, fields of input record and result record are mapped to output by name.
Field Name | Type | Description |
---|---|---|
fileURL | string | Path to the file or directory that was deleted. |
result | boolean | True if the operation has succeeded (can be false when Redirect error output is enabled). |
errorMessage | string | If the operation has failed, the field contains the error message (used when Redirect error output is enabled). |
stackTrace | string | If the operation has failed, the field contains the stack trace of the error (used when Redirect error output is enabled). |
The editor allows you to map the errors and the input data to the error port.
If error mapping is empty, fields of input record and result record are mapped to output by name.
Field Name | Type | Description |
---|---|---|
result | boolean | Will always be set to false. |
errorMessage | string | The error message. |
stackTrace | string | The stack trace of the error. |
fileURL | string | URL of the deleted file or directory. |
Deleting a Single File |
Deleting Directories |
Stop Deleting if Deleting Fails |
Delete a file ${DATATMP_DIR}/delete_me.txt
.
Use File URL attribute.
Attribute | Value |
---|---|
File URL | ${DATATMP_DIR}/delete_me.txt |
Delete directory ${DATATMP_DIR}/old_directory
with all files.
Use File URL and Recursive.
Attribute | Value |
---|---|
File URL | ${DATATMP_DIR}/old_directory |
Recursive | true |
Note: you need to check recursive attribute also in case of deleting of a single empty directory.
Delete files from the following list. If any of files cannot be deleted, stop do no delete following items of the list.
file1.txt file2.txt file3.txt
The files file1.txt
and file3.txt
exist,
the file file2.txt
does not exist.
Get file URLs from the input port one by one and
set Stop processing on fail to true
(default value).
This does not cause jobflow to fail!