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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Haresh
Contributor
Contributor

How to check if a file retrieved from the ftp exists in the local folder?

Hi,

I am using FtpGet to extract or retrieve a file from the ftp and loading into the database and before that i am storing in a local folder.

So before i use tfilecopy to the local i would like to perform a check wherein if the file already exists in the local folder skip or ignore the next steps,if they dont exist then only write (tfilecopy) to the local folder.

So basically i want to iterate through the list of files in the local folder based on the one i am retrieving using

((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")) dynamically and check if that file exists or not amongst the list of all the other files in that folder and perform the action.

Please suggest

Labels (4)
3 Replies
pakapi_
Creator
Creator

Hi Harryishs,

 

where exactly is your tfilecopy component ? Could you please paste here a screenshot of your flow ? Is it something like this ?:

 

tFTPFileList >iterate> tFTPGet >OnSubjobOk>tFileList>iterate>tfileInputDelimited>row>tdbOutput>OnComponentOk>tfilecopy

 

Haresh
Contributor
Contributor
Author

@pakapi_

 

Thanks for the tip,but i am trying to check if a file retrieved from the ftp site either exists in the logfile (an excel file which has the filename retrieved prior) or from a database table if that filename already exists.

 

I found the latter approach more viable than cross-checking by reading from a file,so i took the database route to see if the file i am reading from ftp site already exists in the db tabl,skip it.

 

if the file doesnt exist copy the file onto the destination folder.

 

But here i am unable to see the dboutput in the log...any idea would be appreciated?

 

 

Even though filename is getting displayed in tlogrow1,i cannot see anything after querying the db for results0693p000009rB8UAAU.png

pakapi_
Creator
Creator

What is in tDBInput ? Have you defined schema ? Please paste here tDBInput configuration tab.