Check date stamp for FTP?

  • Is it possible to check the date stamp of a file on an FTP site prior to downloading it?

    The scenario is that I will be using a DTS package to download a file on a daily basis, the file name will all start with INC### (where ### is a batch number) however, I only need to download the one with a date equal to the current date, and the ### is not in a sequence that can be tracked with a counter.

    Example:

    Inc123.txt  12-15-05

    Inc354.txt 12-16-06

     

    I would need the DTS to pick up the INC354 file.

    I am fairly new using DTS, and any help is greatly appreciated.

     

     

     

     

     

  • I think you'll need to get into parsing the output of the FTP DIR command, then issue subsequent GETs based on that parsing.

     

  • I think you should look into using a third party FTP component that you can instanciate from an active-X script and manage your download via programmed logic.  The FTP Task was never designed to do this, and using the command based FTP via calls to the shell would just be a pain to debug.

    -Mike Gercevich

     

  • I am going to use something similar to the below ActiveX Task that another job uses (I changed the FTP info to be generic). My problem is that the new client is not using a mmddyy format for the files to be picked up (like the example below), and I will need to download the most current file that has been posted.  Is this even possible to do in the ActiveX task?

    Function Main()

     

    DIM     ftp 'As FTP_Object.clsFTP

    DIM     mn, dy, yr, xx

    Const   BINARY= 2

    Const   ASCII  = 1

     

    xx         = 0

    yr         = Year(Date-xx)

    mn        = Month(Date-xx)

    dy        = Day(Date-xx)

               

    IF         Len(mn)           = 1       THEN

                mn = "0" & mn

    END IF

               

    IF         Len(dy)            = 1       THEN

                dy = "0" & dy

    END IF

     

    SET     ftp        = CreateObject("FTP_Object.clsFTP")

               

                http://ftp.Connect "login", "password", "ip address"

     

                http://ftp.GetFile "CTDC" & mn & dy & ".QCZ"       ,"D:\List_BKUP\QWest_DNC\CTDC\CTDC" & mn & dy & ".zip"            , BINARY

               

    SET     ftp        = Nothing

                Main    = DTSTaskExecResult_Success

     

    End Function

     

Viewing 4 posts - 1 through 3 (of 3 total)

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