Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Unarchive each single file at a time

Hi all,
I have some 15-20 zip files in one folder, as a part of my job i have to UN-archive each zip file and process the extracted .tsv file and load it in to the oracle table and after successfully loading the processed data in to the table all the extracted .tsv files should be deleted and the parent zip file which is extracted and processed recently should be moved to another folder(Say for example 0683p000009MAB6.pngrocessed folder in the same directory), then the next zip file should be extracted and again the same process should be continued untill all the zip files in the directory are completed,processed and moved to another folder.
Right now i am running my job 15 times for each file which is pretty time taking, Can any one tell me how to loop the entire process for 15 times

For example let us say i have 15 zipped files in my C:/Test directory with names as below
1. file1_2012-04-06
2. file2_2012-04-06
.
.
.
15. file15_2012-04-06

Right now i am using the below job to run 15 times for each single file at a time for each single file
tFileUnarchive --------> tOracleBulkExec ---------> tFileCopy --------> tFileDelete

But running this 15 times is not some thing a professional way of doing, so any one help me to do the above entire process in a single stretch. Please tell me the settings that i need to configure and a sample job if you guys have any
Thanks and Regards,
Pavan
Labels (2)
15 Replies
Anonymous
Not applicable
Author

Hi Pavan,
I think you should use the tFileList as janhess suggested. Example attached.
In the tFileCopy you should use the file name variable coming from tFileList before it (which are the unzipped files I suppose) - ((String)globalMap.get("tFileList_1_CURRENT_FILE"))
The same in tDelete component
But what I can see wrong in your job are links between components. Between the tFileList and tFileCopy should be Iterate link which will proceed copy and delete for all unzipped files. (you don't need copy and delete as separate components, there is 'remove source file' tick box in the tcopy component)
Key in the tContextLoad is defined by you context variable name, value is the file name in this case (different for each iteration). This value should be used as zip file name in your unarchive component.
Cheers
Anonymous
Not applicable
Author

Hi Kelebek,
I didn't get you, can you explain in more clear way. The second image which you have been attached in your above post for tUnarchive is confusing. you have defined context.filepath in Archive file field and context.filename in extraction directory field. I think it should be vice-verse am i right?
Can you show me an image what values should be defined for each context variable defined? And where should i add tFileList, i mean to ask in which job and in which position the tFilelist component should be placed in the job.
Please give me a clear image of the entire job which should be run after which and the context variable values to be used.
I am feeling very embarrassed by asking you so many times, but i have no other options by any means i have to do this job and most worstly i am completely new to talend having nil exp
Thanks and Regards,
Pavan
janhess
Creator II
Creator II

Reading the documentation on components will give you a better understanding of how they work.
Also look at the tutorials and other downloadable documentation.
Anonymous
Not applicable
Author

Hi janhess,
I am confused and i am afraid that i will change my existing job and turn up in a big mess. I am not understanding how we can define the context value for file name.I have attached the image of my job
1.Sample_File_Copy_1.png ---> This is my main job which does all my UN-archiving,Loading,Copying and deletion. Now my big question is how can and what context value should be defined for FileName context variable to get each file name in each iteration
2.Sample_File_Copy_2.png -----> This job will use the context variables defined in first job and pass them to the tRunJob(Sample_File_Copy_1) component for each iteration with a new file name.But what kelebek and you advised is to use tFileList_1, my question is where in which job should i use and what is the sequence and what parameters should be passed or configured

Kindly put in a sequence so that i can understand easily.

Thanks and Regards,
Pavan
janhess
Creator II
Creator II

Put a tFileList at the begining of the job to get all the archive files. Iterate from this for each archive and follow Kelebek's instructions.
FSternberg
Contributor III
Contributor III

Hello, please this information could be important for my problem. Could you give me example in attached?

thanks