Five Stars

[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
1 ACCEPTED SOLUTION

Accepted Solutions
Five Stars

Re: [resolved] tFileList - returns multiple files with same names

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
7 REPLIES
Moderator

Re: [resolved] tFileList - returns multiple files with same names

Hi,
Have you tried to set Directory as c:\test1 to see if it can fetch your specified file?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: [resolved] tFileList - returns multiple files with same names

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
Five Stars

Re: [resolved] tFileList - returns multiple files with same names

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
One Star

Re: [resolved] tFileList - returns multiple files with same names

Can you use tFileProperties to identify the latest file.
Five Stars

Re: [resolved] tFileList - returns multiple files with same names

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
Five Stars

Re: [resolved] tFileList - returns multiple files with same names

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
Moderator

Re: [resolved] tFileList - returns multiple files with same names

Hi Andy,
Thanks for your feedback and sharing your solution with us.
Could you please mark this topic as resolved?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.