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

View solution in original post


All Replies
Highlighted
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

View solution in original post

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 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog