Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
amateur_ak
Contributor
Contributor

how to create a folder with timestamp in context

Hi

I need to create folders with timestamp for my project. I am looking for an option or a way to create folders with timestamp

Regards,

AK

Labels (3)
5 Replies
Anonymous
Not applicable

Hello,

You can set the content of the context variable in the running job by using the "Context Load" component.

At the start of the job insert a tfileinputdelimited Component and a "Context Load" Component.

Establish a "main" link from tfileinputdelimited to the ContextLoad and set the schema of the tfileinputdelimited as Key and Value which is equal to the ContextLoad. In the "key" Field enter a String with the name of your context variable. In the value field enter the Expression TalendDate.formatDate("yyyyMMdd_HHmm",TalendDate.getCurrentDate()).

When you run the job, the context will be set dynamically with the actual time in the given format.

Here is online component reference about: TalendHelpCenter: tContextLoad

Best regards

Sabrina

 

 

amateur_ak
Contributor
Contributor
Author

Thanks Sabrrina. This would still create the filename with timestamp, but i would like know if any option or custom component to set the context folder with timestamp.

 

Cheers,

AK

Anonymous
Not applicable

Hello,

Could you please elaborate your case with an example with expected output values?

Best regards

Sabrina

 

root
Creator II
Creator II

I prefer using tSystem component with the OS specific commands (for permissions)...

 

eg: mkdir folderName_<context.timestamp>

root
Creator II
Creator II

or try this:

 

https://help.talend.com/r/wDRBNUuxk629sNcI0dNYaA/LVyqOf5jpvzw3jzwz3wTJw

 

Not the most elegant approach, but, does the work after deleting the file; the folder will still exist.