Ckecking all the file names from a sftp server if file name exists in table then dont download it.
Hi Everyone,
I am loading a file from sftp to my local directory and then from my local directory to tables, I also have filename table list. once i download all the files to local then i check that filename against filename_table if exixt then dont load it else load
it.
My question is ...Is there a way to check only the filename from SFTP from filename_table befor downloading it from sftp.
Currently I am using winscp in ssis to connect to sftp server.
Thanks
Tej
November 1st, 2012 1:16pm
Hi Everyone,
I am loading a file from sftp to my local directory and then from my local directory to tables, I also have filename table list. once i download all the files to local then i check that filename against filename_table if exixt then dont load it else load
it.
My question is ...Is there a way to check only the filename from SFTP from filename_table befor downloading it from sftp.
Currently I am using winscp in ssis to connect to sftp server.
Thanks
Tej
Free Windows Admin Tool Kit Click here and download it now
November 1st, 2012 1:18pm
Hi Tej,
I only can think of this way:
do a remote dir browse using the dir command and dump the result to a local fie which you then need to parse say with RegEx using a Script Task with .net code.Arthur My Blog
November 1st, 2012 1:26pm
Hi ArturZ
Thanks for your reply.I really appericiate that.
Free Windows Admin Tool Kit Click here and download it now
November 1st, 2012 2:00pm
The other way to do it is using script task since .net has libraries to work with FTP. Your script task can tell you if the required file is in the FTP and then use the ftp task to download it.
November 1st, 2012 8:41pm
Hi Fanor,
Thanks for you reply, but i want it for SFTP, Is there any way to check filename from table and download only files that are not present.
I have a package that loads a files form sftp to my local directory.I am using winscp to do that with script as parameter for winscp
In my script i am synchronizing my local folder with remote server. Is there a way to pass a file name as parameter for winscp.
Thanks in Advance
Free Windows Admin Tool Kit Click here and download it now
November 8th, 2012 2:12pm
Hello Tej,
sorry for the delay in answering your question.
I found an example of code I trust you can successfully adopt.
Reza has a very good demonstration on how you can utilize a Script Task to iterate over a remote FTP directory here:
http://www.rad.pasfu.com/index.php?/archives/29-Loop-through-FTP-Files-On-Remote-Folder-and-Delete-OLD-Files-SSIS-.NET-Code.htmlArthur My Blog
November 8th, 2012 2:42pm
Hi Arthur,
Thanks for this site, It gave me a good idea about connecting and looping througt it.
I think now i just have to figure out how to connect to sftp and use that.
Thanks Arthur.
Free Windows Admin Tool Kit Click here and download it now
November 8th, 2012 2:58pm
...
I think now i just have to figure out how to connect to sftp and use that.
Thanks Arthur.
Need to tell you, the stock FTP Task of SSIS does not provide the means of connecting to SFTP sites.
But there are commercial and free SSIS Tasks that can do that.
Some ideas:
A popular free one would be WinSCP
A commercial equivalent with which it is not as intimidating to work are from
CozyRoc, PragmaticWorks
Arthur My Blog
November 8th, 2012 3:03pm