问题
I would like to archive every file in a folder by putting it in another archive folder with a name like this: "Archive/myfolder-06-2014"
My problem is how to retrieve the current month and year and then how to create a folder (if it does not already exist) with these data.
回答1:
This solution may be a little awkward (due to the required fuss) but it seems to work. The idea is to precompute the target filename in a seperate transformation and store it as a system variable (TARGET_ZIP_FILENAME
):
The following diagrams show the settings of selected components.
- Get the current time...
- Provide the pattern of the target filename as a string constant...
- Extract the month and year as formatted integers...
- Replace the month in the pattern (the year will work equivalently)
- Set the resulting filename as a system variable
The main job will call the transformation and use the system variable as the zip target filename.
Also you have to make sure that the setting Create Parent folder
is active:
来源:https://stackoverflow.com/questions/24283177/pentaho-create-archive-folder-with-mm-yyyy