Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Copy the list of file to other folder

Hi, 

I want to copy list of file in folder 1 to folder 2. In this folder 2, I store only the files that have the newest date.

For ex: i have the list of file in the folder 1 (6 files)

         A1_scope_20180818.csv

        A1_scope_20180820.csv

        A2_scope_20180818.csv

        A3_scope_20180819.csv

        A4_scope_20180821.csv

        A4_scope_20180818.csv

After the traitement, i want to obtain the list of file in the folder 2 (4 files)

 A1_scope_20180820.csv, A2_scope_20180818.csv,  A3_scope_20180819.csv,  A4_scope_20180821.csv.


Here is the process of recover the filename and date of each file
tFileList -> tFixedFlowInput -> tIterateToFlow -> tMap -> tMemorizeRow -> TJavaFlex

 

I used component "tJavaFlex" to store filename and date in HashMap<String,Date>. In this HashMap, it contains only the filename and date of file corresponding ().

0683p000009LzfG.png

 

Now i want to copy the list of file which contain the namefile in HashMap to new folder (folder 2)

Have you an idea for this.

Thanks 

Br

Giang

 

 

 

Labels (5)
1 Solution

Accepted Solutions
fdenis
Master
Master

In Talend:
green links are iteration.
orange links are line by lines data.
at the entrance of tFileCopy your data (fileName) is in a dataset (named row2).
then you have to use row2.filepath in tFileCopy / File Name
Regards,

View solution in original post

10 Replies
fdenis
Master
Master

you did not nead tJavaFlex.
Think of person who is reopening your job , the quickest way is visual.
use tFileList
link with iterate
tIterateToFlow
use gloalMap CURENTFILE and CURENTFILENAME
filter filename with tMap
then tFileCopy using curentfilePath.
Regards,
Anonymous
Not applicable
Author

In tMap, how can i recover list of file which have the newest date. I have juste recovered code and date in the file name with fuction substring. but i don't know check:

  • if code is unique and date is the newest date, copy to new folder
  • if code already existe in new folder, compare the date and replace the file with newest date

Can you explan the more detail.

Thanks

Regards

Giang

fdenis
Master
Master

sorry...
Ones you have your list use tMap to split file name and date
then Use tAggregate to keep the max date for each file name
Anonymous
Not applicable
Author

in tFilecopy, i want to call the column filepath in tAggregateRow. how can i call it?

 

Thanks

Regards

ledoan
0683p000009LzfL.png

fdenis
Master
Master

into tIterate to flow you have to define global Value who are going to be convert as row.
you can use (String)globalMap.get("tFileList_1_CURRENT_FILE")
and (String)globalMap.get("tFileList_1_CURRENT_FILEPATH")
Regards,
Anonymous
Not applicable
Author

Hello fdenis,

Yes i put ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")) into component tIterateToFlow and i called this field into component tFileCopy also.

But i don't understand why there is only one file who is copied in the new folder, on the other hand, the flux of this job is marked that there are 28 rows. 

Do you know where is problem.

Thanks

Giang

0683p000009Lzfp.png

fdenis
Master
Master

you cannot use this global value in tFileCopy.
tListList All file
tIterateToFlow convert to row.
then tMap… at this point the tFileList and his global value are at the end of the list.
you may use row2.filename or tFlowToIterate and use this generated global variable.
Regards,
Anonymous
Not applicable
Author

i don't understand your answer. Can you explana more detaile.

 

Thanks

Regards

le doan

fdenis
Master
Master

In Talend:
green links are iteration.
orange links are line by lines data.
at the entrance of tFileCopy your data (fileName) is in a dataset (named row2).
then you have to use row2.filepath in tFileCopy / File Name
Regards,