user11492726
user11492726

Reputation:

pentaho spoon/PDI : how to create a folder with current date?

As the title says, I'd like to know how to create a folder with current date(dd/mm/yyyy) (on Job). I've seen two answers but they seemed quite long, for example this one: pentaho create archive folder with MM-YYYY

Anyone has an idea? Thanks :)

Upvotes: 0

Views: 2663

Answers (1)

Cristian Curti
Cristian Curti

Reputation: 1054

That answer is also from 2014, better and newer versions of PDI are out, and this answer is overcomplicating the task.

Though you do need to create the folder name in a KTR, you can just use the 'Create folder' Job step. I'm pretty sure you cannot set AND use a variable in the same JOB/KTR that you have set it to begin with. So you need a KTR that generates a Date and sends it as string to a JOB.

Your KTR should like this, to create a String date with the format YYYY-MM-DD

enter image description here

And your Job like this

enter image description here

Also remenber, you can't create folders with '/', so you have to use another pattern.

This is a very simplistic approach, there are other ways to automate folder creation through use of variables.

EDIT: Corrected the JOB image, the first KTR needs to actually run for the variable to be set, sorry for the confusion.

Upvotes: 2

Related Questions