Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] tFileList - returns multiple files with same names

Hi,
I need some urgent helps with this situation here where I am using tFileList to pull files from a directory.  The files have same file names but under different sub-directories.  For example:  I want to pull "john_doe.txt", so I listed it in Filemask, and Directory is set as c:/ ,  but "john_doe.txt" exists in multiple directories, their file size is different:
c:\test1\john_doe.txt
c:\test2\john_doe.txt
How can I pull the file just under c:\test1 ?   I have about 20 other files with the similar situation.
Thanks
Andy
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,
I have resolved the issue myself.  I just coded the following string into the "run if" properties to exclude the files I don't want from tFileList:
!((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY").contains("test2") ||(String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY").contains("test4"))
Thanks,
Andy

View solution in original post

7 Replies
Anonymous
Not applicable
Author

Hi,
Have you tried to set Directory as c:\test1 to see if it can fetch your specified file?
Best regards
Sabrina
Anonymous
Not applicable
Author

Sabrina,
If I set Directory as "c:/test1" and Filemask as "john_doe.txt", then john_doe.txt will be pulled but not from c:\test2. 
How can I perfrom this if I have Filemask listed:
john_doe.txt
marry_jane.txt
mike_dee.txt
The directories in my local workstation for those files are:
c:/test1/john_doe.txt
c:/test2/john_doe.txt
c:/test3/marry_jane.txt
c:/test4/mary_jane.txt
c:/test5/mike_dee.txt
c:/test6/mike_dee.txt
I only want files from c:/test1, c:/test3, and c:/test5 since they are newer.  how do you set up the directory path within tFileList to get those?
Thanks
-Andy
Anonymous
Not applicable
Author

Hi,
Can you please confirm if tFileList will fetch all files specified in "filemask" and under the "directory" including files with duplicate names?
If true, what alternatives do I have to eliminate the duplicates?
Thanks
Anonymous
Not applicable
Author

Can you use tFileProperties to identify the latest file.
Anonymous
Not applicable
Author

Not sure how can tFileProperties filter the files that I don't want to copy.  I had tried another idea using "run if" and connect to tFileCopy.  Under "if" properties, I put the following:
!((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY")).contains("test2") ||!((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY")).contains("test4")

Obviously the codes didn't work.  It didn't exclude the files from test2 and test4 directories.  Can someone please provide the proper java codes to exclude when the directory path name not contains "test2" or not contains "test4" ?
Thanks,
Andy
Anonymous
Not applicable
Author

Hi,
I have resolved the issue myself.  I just coded the following string into the "run if" properties to exclude the files I don't want from tFileList:
!((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY").contains("test2") ||(String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY").contains("test4"))
Thanks,
Andy
Anonymous
Not applicable
Author

Hi Andy,
Thanks for your feedback and sharing your solution with us.
Could you please mark this topic as resolved?
Best regards
Sabrina