Deleting one or more files
Kettle provides two job entries for deleting files: Delete file and Delete files. You can find both in the File management category of entries.
In this recipe, you will see an example of how to delete a file. You will delete a file that includes the current date as part of its name, for example test_20101020.txt
.
Getting ready
You must create a sample file; for example, test_20101020.txt
. Make sure to use your current date instead of 20101020
. Use the same format (yyyyMMdd
).
How to do it...
Perform the following steps to learn how to delete one or more files:
Create a new transformation.
Drop a Get System Info step from the Input category into the work area.
Double-click on the step and add a field named
date
. In the Type column, select system date(fixed).Add a Select values step from the Transform category. Open it, and under the Meta-data tab, add
date
as Fieldname, set the type to String, and type or select yyyyMMdd in the Format column.From the Job category, add a...