[resolved] Create Folder in Job

One Star

[resolved] Create Folder in Job

Good Morning,
I am using a tFtpGet for a file and upload it to another ftp by tFtpPut component.
To do this, I need to create a temporary folder does not exist, which make the intermediate step.
How can I do it?
Thank you so much.

Accepted Solutions
Community Manager

Re: [resolved] Create Folder in Job

Define a context variable called directorypth and set its value which is the directory path you want to create.  In the begin of job, using a tJava and write this code to create a directory.
new java.io.File(context.directorypath).mkdirs();

on tFTPGet or tFTPPut, you can set the Local Directory filed with context variable.
In the end of job, you can use tFileDelete to delete the directory if needed.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: [resolved] Create Folder in Job

Define a context variable called directorypth and set its value which is the directory path you want to create.  In the begin of job, using a tJava and write this code to create a directory.
new java.io.File(context.directorypath).mkdirs();

on tFTPGet or tFTPPut, you can set the Local Directory filed with context variable.
In the end of job, you can use tFileDelete to delete the directory if needed.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Create Folder in Job

Define a context variable called directorypth and set its value which is the directory path you want to create.  In the begin of job, using a tJava and write this code to create a directory.
new java.io.File(context.directorypath).mkdirs();

on tFTPGet or tFTPPut, you can set the Local Directory filed with context variable.
In the end of job, you can use tFileDelete to delete the directory if needed.
Best regards
Shong

Thank you very much for your answer, I found it very useful.
Regards.