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] Component to test if FTP folder exist?

Hello,
I am looking for a simple way to test if a ftp folder exists.
I have tested with tFTPFileExists and tFTPFileList, but no chance. When folder does not exists a java exception is thrown.
How can I do a such test with Talend?
I am working in TOS 4.1.0M3
Thanks for helping,
Eduard
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Try this way

tJava Code:
context.test = 
((String)globalMap.get("tFTPGet_1_ERROR_MESSAGE")).equals("test: No such file or directory") ? "yes" : "no";

if statements code:
context.test == "yes"
context.test == "no"

As I don't think there is a more soft way, that I know of atleast i may be mistaken

View solution in original post

5 Replies
Anonymous
Not applicable
Author

Take off die on error.
Then it will be:
tFTPGet --on Subjob Failure--> Desired Component
Look at the images below to help you.



If you want it to loop the job again until the Directory exists ask me and I will show you another example.
Regards
Brandon
Anonymous
Not applicable
Author

Hi Brandon,
In my very first approach I wanted to do it "more soft" : without raising any exception.
If there isn't any other way I will do it like this, and try to workaround the exception with logging set up.
Many thanks for your help,
Eduard
Anonymous
Not applicable
Author

Try this way

tJava Code:
context.test = 
((String)globalMap.get("tFTPGet_1_ERROR_MESSAGE")).equals("test: No such file or directory") ? "yes" : "no";

if statements code:
context.test == "yes"
context.test == "no"

As I don't think there is a more soft way, that I know of atleast i may be mistaken
Anonymous
Not applicable
Author

Many thanks for your help Brandon,
your solution is quite good.
If there is no other solution I will set this topic as resolved.
Eduard
AAA999
Contributor III
Contributor III

Hi Brandon,

I saw your post and looking for a solution to check if the file exists on ftp server using tftpfileexist. If not it should check again every 1 minute and kick the job once the file is found and send a notification once the process is done and loop back to check for the next file. If the file is not found after certain period it should send a notification and loop again to check if the file is present. How to achieve this? A detail job would be helpful.

Thanks