Deleting one or more files
Kettle provides two job entries for deleting files: Delete file and Delete files entries. 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...
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 the Fieldname
date
, set the type to String and type or selectyyyyMMdd
in the Format column.From the Job category, add a Set Variables step. Double-click on it and fill in the grid...