FTP: Get Every Changing List of Files

  • I have an FTP site that is constantly getting files uploaded to it throughout the day (100-150 files a day). The naming of the files is unique without a consistent pattern. I want to use DTS to pick up these files. My ideal goal would be to have DTS pick up the file as soon as it is dropped onto the site. I don't know if that is possible with DTS, so my next approach would be to schedule a task that would just pick up all of the files that are currently at the site. Either approach results in the same question for me . . . how do I get the files when I have no clue what the name of the file is going to be ????

    Thank you.

  • Hi CloseToDeath

    You cannot do it with built in DTSFTPTask. Anyway there is a lot of problems with

    the FTPTAsk if it does not get the right information.

    But you can build an CreatProcessTask which will use the standard http://FTP.EXE

    You would need to pass to it the command

    I use the following syntax:

    CMD /C D: && cd "\destinationFolder" && C:\winnt\system32\ftp.exe -s:"Pull.txt" > Pull.log

    Below is an extract from my code ( in the task preceeding the "DTSTask_DTSCreateProcessTask_1" )

    but if you do not need the change here you can hard code inside the "DTSTask_DTSCreateProcessTask_1" task.

    CONST DRIVE = "D:"

    ...

    strFTPCommand = "C:\winnt\system32\ftp.exe"

    ...

    strDestPath = ... You have to put something here.

    strBatchLine = "CMD /C " & DRIVE & " && " & "cd " & chr(34) & strDestPath & chr(34) & " && "

    strBatchLine = strBatchline & _

    strFTPCommand & " -s:" & chr(34) & "Pull.txt" & chr(34) & " > " & "Pull.Log"

    ......

    set objPackage = DTSGlobalVariables.Parent

    For Each objTask in objPackage.Tasks

    'you have to specify your condition here for your task name

    'strYourTaskName would be "DTSTask_DTSCreateProcessTask_1"

    'if you have only one and you did not change the default name.

    IF objTask.Name = strYourTaskName THEN

    Set taskprops = objTask.Properties

    Set varObjProperty = taskprops("ProcessCommandLine")

    varObjProperty.Value = strBatchLine 'here you assign the commanfd to your

    EXIT For

    END IF

    Next

    I create before the Pull.Txt file in the destination folder ( in an ActiveXscript task).

    It contains all the necessary commands. ( you can place there "mget *.*" line to get all the files).

    After that in another ActiveX script I open the log file and examine it - to determine the outcome.

    Cheers Tom

    P.S. I can provide more info if you need. he extracts are from the working solution.

  • Is the only way you can get to the server FTP? If you can get there with the filesystem you can use the filesystem object in an activeX task to help you out.

    Bruce Szabo, MCSE+I, MCDBA, MCSD


    Bruce Szabo, MCSE+I, MCDBA, MCSD

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

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