Get new files and folders from FTP

  • I need to check an ftp site nightly for new folders containing image files and download just the files and folders and exclude folders that I don't need. There hundreds of folders and each folder containing from 5 to 10 image files. I have already done an initial download of all of the file that I need. There new files uploaded to the site on a regular basses. I just need those new files. Can any one help me with this?

  • There are several methods to achieve this:

    Most basic:

    have a file archive mechanism in place, once you have processed the file, move the file to an alternate location so that the source folder in FTP is always empty and every time you package will read only new files

    Raunak J

  • Thanks Raunak,

    I can't modify the source folder. I can only download the files.

  • What happens to the files which are already downloaded and processed? Can you describe the workflow? This will enable the folks to answer the problem

    Raunak J

  • you have to keep track of the files already processed someplace. that's #1. do you have that accessible?

    Like Raunak Jhawar suggested, you'd move the processed files someplace, like to an Archived\ folder, and delete them / move them from the FTP site.

    otherwise you have to open the FTP connection, read the list of files(which gets tricky to script), and then you can compare all files vs already processed files; that list of already processed files could be either a list of all files in the archived folder, or in the database somehow;

    so much of it depends on the existing process, i'm not sure i can offer much more advice than that.

    all those steps sound like a whopper of a script task to me.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • As suggested above, if you can have the track of file every time you are saving to a table in the database (one simple Execute sql task can do), you can use that table to lookup if that image is present or not and then skip if it is present or move to the new folder if it isn't.

    Good Luck 🙂 .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply