[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
Highlighted
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.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

APIs for Dummies

View this on-demand webinar about APIs....

Watch Now