Appending data to a list of files.

Four Stars

Appending data to a list of files.

Hi group, I am a newbie to Talend and am stuck with this task. I've a raw file with 5 lines and 10 files in a directory. My requirement is to append these 5 lines as first 5 lines in each of the 10 files. Please comment any ideas!

Twelve Stars

Re: Appending data to a list of files.

use tfilelist to list all the files and iterate flow to tfileinputdelimited and the on target, tfileoutputdelimited enable Append.

Manohar B
Sixteen Stars

Re: Appending data to a list of files.

Unfortunately append will only append to the end of the file....not the beginning. This needs to be thought about in a different way. Use the tFileList and iterate over the files as @manodwhb suggested. But in each iteration use a tFileCopy to copy your file with 5 rows to a new name. Then read from your files that are being iterated over and append that data to the end of the new file you've copied.

 

Four Stars

Re: Appending data to a list of files.

can you please elaborate your answer. Are you suggesting to connect tFileList to tFlowToIterate (which isn't possible)? or are you suggesting in another way.

Twelve Stars

Re: Appending data to a list of files.

@Pruthvi,you should desing as shown in screenshot.Untitled.png

Manohar B
Twelve Stars

Re: Appending data to a list of files.

@Pruthvi,still do you an issue?

Manohar B