FTP in DTS

  • I am trying to move files from an FTP site to another server for processing. Using the FTP task, it seems to just copy the file and leave the original. I would like to delete the original from the FTP site once it is transferred. Is there an easy way to do this?

    Thanks

  • You can use xp_cmdshell and delete the file using dos command.

  •       'Create FTP Job File

           Set fsFTP = CreateObject ("Scripting.FileSystemObject") 

           Set fFtpFile = fsFTP.CreateTextFile("FTPJob.txt", True) 

           fFtpFile.Writeline "user UserName Password

           fFTPFile.Writeline "cd " & TargetFolder

           fFTPFile.Writeline "lcd " & SourceFolder

           fFTPFile.Writeline "ascii"

           fFTPFile.Writeline "prompt off"

           fFtpFile.Writeline "put " & strFileName & ".dat"

           fFtpFile.Writeline "delete " & strFileName & ".dat" 

           fFtpFile.Writeline "bye"

           fFtpFile.Close

    ....

    'Create a Shell object using CreateObject("WScript.Shell") 

    'Execute the following statement

    ret = ws.run ("ftp -v -i -n -s:FTPJob.txt 111.111.111.111" ,0, True)

    Otherwise

    you can also call this job file using xp_cmdshell and execute it.

    Hope this helps!!!!

     

     

  • Looks like the right direction but I am unfamiliar with using job files. I need to loop through a bunch of folders and FTP all the files in them - and then delete the files.

    Can you give me an idea of how this might work or point me to some other examples?

    Thanks

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

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