Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems w/ Active X Get from FTP Server

Status
Not open for further replies.

an0nyM0use

IS-IT--Management
Nov 15, 2004
15
US
I am having difficulties getting my script to retrieve this file. It needs to change directories once it connects to the FTP Server in order to retrieve the file. This is th script I am trying to use. Any suggestions would be very welcome.

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()

Dim remoteURL, username, password, transferMode, localDir, remoteDir, remoteFile

Dim fso, ftpscrfileName, ftpscrfileDir, scriptscr, ftpscrfile

Dim ReturnCode, Ouput

Set fso = CreateObject("Scripting.FileSystemObject")
ftpscrfileDir = cd "C:../docent/"
ftpscrfileName = ftpscrfileDir & "My_Prod_LMS.zip"

Set ftpscrfile = fso_OpenTextFile(ftpscrfileName, 2, True)

remoteURL = "my ip address here"
username = "MyUID"
password = "MyPass"
transferMode = "bin" '-------asc (ascii) /bin (binary)
localDir = "D:InetpubFTP_Root\Docent_DB_Backup"
remoteDir = cd "../docent/"
remoteFile = "My_Prod_LMS.zip"

scriptscr = "open "& remoteURL & vbcrlf &_
username & vbcrlf &_
password & vbcrlf &_
transferMode &vbcrlf &_
"lcd "& localDir & vbcrlf &_
"GET "& remoteDir &""& remoteFile & vbcrlf &_
"bye"

End Function
*******************************************************

Thanks,
Kevin
 
Maybe this is a irrelevant question, but if you have SQL2000, is there a reason you couldn't use Ftp-task in dts ?

Cheers
 
The way the FTP server is set up it doesn't allow me to directly declare the path to ../docent dir. If I try and view the files through the 'files' tab on the FTP task, I can't see any because of the way the security is set up on this FTP server. Unfortunately, this server is my only option to get the files in through my firewalls. You know usual corporate policies etc..

Thanks,
Kevin
 
I guessed in had something to do with policies.. Maybe you could type in the filename with Disconnected edit. It's not that difficult. This means you create the ftp task without entering files-tab, just OK the task in the location tab. Then right-click on white space of the package and choose Disconnected edit. Locate from Task your ftp-task and 2-click SourceFilename. Type in 'filename';'';'' (two single-quotes, not double-quotes).

And, you could use Dynamic Properties Task to set the filename, then you could parametrize the whole thing.

But I can understand you want/have to use your scripting.

Cheers
 
It's nice to learn about the 'Disconnected Edit' feature, but I am getting an FTP task error for invalid string format for source file name. I am afraid that part of the problem is I don't see where I can tell the FTP Task that it needs to CD or CWD to ../docent to find the file.

Thanks,
Kevin
 
I think all of your activex script wasn't there, that wount even parse... You probally tested the ftp transfer manually so it's not a config issue.

(Maybe the ftp-task SourceFilename has to be in english locales '','','' )

One alternative is, if possible, to write the ftp-transfer into a bat/cmd file and call that with Execute Process Task.

Sorry couldn't help you.

Cheers
 
>You probally tested the ftp transfer manually so it's not a config issue.

Or maybe you didn't.

Manually, do everything you need doen programmatically. The problem will reveal itself very quickly.
 
I use Smart FTP to manually perform this process at this time. This is what I am trying to get away from. I don't know much about creating batch files etc.. so I am trying to use the activeX script as this is the way it was done in the past. Unfortunately the old way was using an http connection that was able to go directly from one server to the other without requiring the FTP server as the middleman. I think what happened was the DB got to large and started causing timeouts during the http connect. So since this is the reason for using FTP I figured that would be the right way to go. The problem is just the security around our FTP server. I can't even see the files there, I can only retrieve them. Meaning you have to know what you are looking for.

-Faris
"Eagles may soar, but weasels don't get sucked into jet engines.
 
Try this as SourceFilename:

'My_Prod_LMS.zip';'../docent/';''
or if that gives invalid string format error
'My_Prod_LMS.zip','../docent/',''

Destination file name will be the same as source file name, but that's not that big issue.

Cheers
 
In the end I wound up creating a .cmd batch file to which I called with a scheduled job.

-Faris
"Eagles may soar, but weasels don't get sucked into jet engines.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top