File Moving and Renaming

Seven Stars

File Moving and Renaming

Hello,

 

I have multiple files on my main folder and i have to look for two files in it.

file1_140618.csv

file2_140618.csv

 

Please note that the date in these files keep changing.

 

What i actually do:

When i check the 1st file, it has to log the information (file_properties) in a file before moving and renaming it to another folder.

The same thing applies to the second file lookup; same step.

 

At this moment, I am not able to use one filelist because the tfilecopy does not have the regular expression option. And also i will not know which file is being taken into consideration while using ((String)globalMap.get("tFileExist_1_FILENAME")) in the tfilecopy.

 

tu.JPG

 

df.JPG

 

Can you suggest how i can optimize this job Or is there a better way to do this?

 

Thank you.

 

Best regards,

asadasing

 

 

 

df.JPG

 

 

Is there a way to optimize this job; i meaan

 

Forteen Stars TRF
Forteen Stars

Re: File Moving and Renaming

A single subjob with tFileList-->tFileProperties-->tFileOutputDelimited-->tFileCopy should be enough.

You should use "tFileList_1_CURRENT_FILEPATH" instead of "tFileExist_1_FILENAME" in tFileCopy (or I miss something).


TRF
Eleven Stars

Re: File Moving and Renaming

you can use:

only one tFileList

file path is globalMap.get("tFileList_1_CURRENT_FILEPATH")

tfileexist is not mandatory

onSubjobOk is Better after iterate.

 

Regards

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Seven Stars

Re: File Moving and Renaming

Thank you for your quick reply.

 

Lets assume i have to rename the files mentioned as follows:

 

file1_140618 => client1234abc

file2_140618 => client987xyz 

 

Then what should i put in my tfilecopy >> destination filename?

Forteen Stars TRF
Forteen Stars

Re: File Moving and Renaming

Where does the target filename come from?


TRF
Seven Stars

Re: File Moving and Renaming

Normally,

 

i will have only two files:

 

Client_xxxxx

Address_xxxxx

 

And my target name should be:

 

Client_xxxxx => customers_1806181540 (currentDateTime)

Address_xxxxx => Address_1806181540 (currentDateTime)

 

As at now, i am hard coding both files in the talend interface.

 

Capture3.JPG

Eleven Stars

Re: File Moving and Renaming

if you want the best way to do this, it's the best way.
when you open talend you can directly speak about 2 file who are going to be copied.

Optimizing ?
- Speed
- Globalisation (do the same for all incoming files)
- Alerting (if one file is not present)
what is the next step
you are the only one who can say "it's the best way!"

Francois Denis

Tag as "solved" for others! Kudos to thanks!