Read multiple files from source (Input) but load only latest file. Once successfully loaded remove all the files from input folder.
Procedure:
1. Create a job named as job_multiple_files_into_single_target and scan metadata of a single file from a folder.
2. Drag and drop the scanned metadata i.e file delimited into the job design workspace and make it as tfileinputDelimited.
3. Now take tfilelist component
and choose the directory from where you need to extract the files. Click on ‘+’
button to add a file mask “*.csv”.
Note: To get the latest file as output after loading files we need to check
the options- order by as Modified Date and order action as ASC
4. Connect tfilelist to tfileinputdelimited using rowà iterate
5. Double click on tfileinputdelimited component, change property type to repository to built-in remove the file location, use cntrl+space button to choose global variable called ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
6. Connect tfileinputdelimited to tfileoutputdelimited using row-->main
Note: To improve performance select the iterate link. Right click go to settings enable parallel execution
option. Give some number.
7. Now drag the tfileDelete component from pallete and give the directory of the folder/files that should be deleted after loading.
8. Connect tfileList and tfileDelete using triggerà OnsubjobOK.
9. Run the job.
JOB:
OUTPUT:
No comments:
Post a Comment