DTS - FTP

  • I am hoping to find a better solution to the one I am using aty the moment.  I have a DTS that extracts tables to files and then posts them on a remote FTP server. 

    Now the FTP Task allows you to fetch data from a FTP server, but not to post to it.  I wrote 2 ActiveX scripts to do this.  The first one creates a FTP Script File:

     On Error Resume Next

     strSourcePath= \\Server01\DBBackup\Data

     Set fso=CreateObject("Scripting.FileSystemObject")

     Set objTextFile=fso.createtextfile(strSourcePath & "\FTPSend.txt",TRUE)

     objTextFile.Writeline ("open ***.***.***.***")

     objTextFile.Writeline ("LOGIN")

     objTextFile.Writeline ("PASSWORD")

     objTextFile.Writeline ("put " & DTSGlobalVariables("qv_File01").Value)

     objTextFile.Writeline ("put " & DTSGlobalVariables("qv_File02").Value)

     objTextFile.Writeline ("Quit")

     objTextFile.Close

     SET objTextFile = nothing

     SET fso=Nothing

    The second executes FTP in DOS with the script file

     SET ws=CreateObject("WScript.Shell")

     Ret=ws.Run ("ftp -s:\\Server01\DBBackup\Data\FTPSend.txt -i",0,True)

    Is there any better way of doing this? 

    P.S.: We use SQL2K Std SP3.

     

    <hr noshade size='1' width='250' color='#BBC8E5'>Kindest Regards,

    Roelof
    <a href='http://' class='authorlink' target='_blank'></a>

    --There are only 10 types of people in the world. Those who understand binary, and those who don't.

  • We normally use an ActiveX control. There are a few good commercial ones including the Xceed component, but we often just use freeware ones like AspFtp. Here's a sample script.

    Function Main()

     dim oFTP

     set oFTP = createobject("niblack.aspftp")

     oFTP.bQPutFile "http://ftp.mycompany.com.au","username","password","\\myserver\myshare\myfolder\myfile.txt","/remotefolder/remotefile.txt",1

     set oFTP = nothing

     Main = DTSTaskExecResult_Success

    End Function

    Shane

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

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