Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
ml1662663516
Contributor II
Contributor II

Trying to compare if certain filenames from an input text file are found as actual files in a given directory

Very new to Talend and have learned a lot from the community so far.

 

What I am trying to do is basically what I said in my subject.

 

I will be given a list of filenames (more than likely in a text file, but I am able to request the format within reason) and I then need to be sure those filenames are found within a given directory.

 

Input TXT file:

abc.txt

def.txt

ghi.txt

 

Directory Example One:

abc.txt

123.txt

 

Would return FALSE/ERROR since all filenames were not in the directory.

 

Directory Example Two:

abc.txt

def.txt

ghi.txt

123.txt

 

Would return TRUE/NO ERROR since all filenames were in the directory.

 

Any help or guidance on this job would be greatly appreciated.

 

Thank you!

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

You can do an inner join between input_file and directory file based on file name, if the line number of output table equals to the line number of input file, then set the return value as true, otherwise, it is false.

 

For more details, please refer to the below screenshots.

 

0695b00000UyvtrAAB.png0695b00000UyvtwAAB.png0695b00000Uyvu1AAB.png 

 

Regards

Shong

View solution in original post

3 Replies
Anonymous
Not applicable

Hi

You can do an inner join between input_file and directory file based on file name, if the line number of output table equals to the line number of input file, then set the return value as true, otherwise, it is false.

 

For more details, please refer to the below screenshots.

 

0695b00000UyvtrAAB.png0695b00000UyvtwAAB.png0695b00000Uyvu1AAB.png 

 

Regards

Shong

ml1662663516
Contributor II
Contributor II
Author

Thank you for the quick reply. I have learned a lot from your answer.

However, I need to base the results on the actual file names and not the file count.

I need to be sure the file names in the text file are present in the directory.

Would it be possible for you to elaborate more with those requirements?

Thank you very much!

ml1662663516
Contributor II
Contributor II
Author

Thank you again for your great help. I am pretty sure I got everything work.

 

I greatly appreciate it!