What is the correct way to run scripting when protocol
ftp://
is required?
I am running Version 4.2.1 (Build 428) and having problems running a script while being required to use
ftp://
and passive mode. The process needs to be automated and run within a SSIS package. I have another FTP process defined with SSIS using WinSCP that doesn't require the
ftp://
and passive mode working without a problem. I have tried several approaches, all of which don't seem to work. The only way I have been successful has been by manually executing the FTP process. For security reasons, protocol
ftp://
ignores any scripting so the following SSIS package connects correctly but doesn't execute the script:
Executable:
\\server\WinSCP.exe
Arguments:
ftp://userID:pwd@ABC.com :21 /passive /option binary /script=""FTPScript.txt
The second option that was tried was to try the
OPEN
command inside of a script. This option doesn't make a connection on the destination site:
SSIS package
Executable:
\\server\WinSCP.exe
Arguments:
/script="FTPScript.txt"
FTPScript.txt
looks like:
Open ftp://userID:pwd@ABC.com :21 /passive /option binary
option batch abort
option confirm off
cscript PutFile.vbs
PutFile.vbs
contains the following:
Dim objShell, intRtn, sMonth, sDay, sYear
sMonth = cstr(MONTH(Date))
sDay = cstr(DAY(Date))
sYear = cstr(YEAR(Date))
Set objShell = WScript.CreateObject ("WSCript.shell")
command = "put D:\PaymentExtract\101003927_" & sMonth & sDay & sYear & "_file.txt"
intRtn = objShell.run (command)
Set objShell = Nothing
The other option I tried was using a BAT file that executed a script using cscript:
FTPFile.bat
contains 1 line of code that reads:
PutFile.vbs
looks like the following:
Dim objShell1, objShell2, intRtn1, intRtn2, cmd1, cmd2, sMonth, sDay, sYear
sMonth = cstr(MONTH(Date))
sDay = cstr(DAY(Date))
sYear = cstr(YEAR(Date))
cmd1 = "\\server\path\winscp.exe ftp://userID:pwd@ABC.com :21 /passive /option binary /
cmd2 = "Put D:\PaymentExtract\101003927_" & SMonth & sDay & sYear & "_file.txt"
Set objShell1 = WScript.CreateObject ("WSCript.shell")
intRtn1 = objShell1.run (cmd1)
Set objShell1 = Nothing
Set objShell2 = WScript.CreateObject ("WSCript.shell")
intRtn2 = objShell2.run (cmd2)
Set objShell2 = Nothing
I have executed the BAT process at a cmd prompt and received and error message that it states:
PutFile.vbs (30,1) (Null): The system cannot find the file specified. Line (30,1) represents the PUT command.
Does anyone have any ideas?