none
Is it possible to see the count of files downloaded from FTP site using FTP Task?

    Question

  • Hi All,

    Question: How to confirm multiple files were downloaded during a single FTP Task execution with neither a flat file connection manager nor the names of the files themselves?

    Background: Every day, our vendor generates a new data file for us to download.  Due to the file name standard that includes create date and time ("ftp_file_2014-03-27-10-59-59.csv"), we have no idea what the file name will be unless we go looking for it manually.  I've remedied this problem in the FTP Task Editor by using an Expression Variable for the remote path that builds a file mask (for example, "ftp_file_2014-03-27-*.csv").  This works fine for downloading the right file at the right time.

    The download package doesn't always get called daily, so I put the FTP task in a loop that loops through days from the last successful import to today.  All's still fine.

    Unfortunately, the vendor can't be trusted to provide us only one file per day.  This is possible because the create time also appears in the file name, ensuring uniqueness in all file names.  The FTP Task will download all the files that match the file mask, and if that is more than one file, I need to hit the kill switch on this package: delete the 2+ files downloaded [but not the previous days' files], log the error, and don't download any more files for later dates.

    Thanks,
    Eric B.

    Friday, March 28, 2014 9:20 PM

Answers

  • Use a Script Task with this code :

    System.IO.Directory.GetFiles(@"YouPathDirectory").Count<String>().ToString();

    Note :
    It will return also a hidden files 
    Saturday, March 29, 2014 12:47 AM

All replies

  • Use a Script Task with this code :

    System.IO.Directory.GetFiles(@"YouPathDirectory").Count<String>().ToString();

    Note :
    It will return also a hidden files 
    Saturday, March 29, 2014 12:47 AM
  • I wasn't able to try this suggestion because I wasn't sure how to set the path directory to an FTP folder. Instead, I'll download the files and then check to see if we have multiple files per day, at which point I'll log them and move them to another folder.
    Wednesday, April 02, 2014 6:01 PM
  • You can get the list of files on the FTP server. However it requires implementing code. Check the script here for reference.

    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

    Thursday, April 03, 2014 5:33 PM