Link to home
Start Free TrialLog in
Avatar of LuckyLucks
LuckyLucks

asked on

importing files off a ftp site to a dir

Hi: I am trying to accomplish grabbing files off the ftp site and downloading them into a dir. SInce neither the name nor the number of files in the ftp site dir are fixed, I tried something like below but with issues.
1. create a global variable that sets the connectionfile parameter to C:\ConnFOlder\connfile.txt
2. the connfile.txt looks like:
            ftp.x.com
            myusername
            mypassword
            mget *.*
            quit
3. An active script tries to set up a connection and download the files as follows:

Function Main()
 
Dim oConn, sFilename

Set sFilename= "local"
Set oConn = DTSGlobalVariables.Parent.Connections("connfile.txt")
oConn.DataSource = sFilename


Set oConn = Nothing
Main = DTSTaskExecResult_Success

End Function

But I keep getting the error theat object not defined (String:local). Am I missing something? Is there an easier way that I can involve the FTP object into the active script as well and solve the problem?


thanks.
Avatar of nmcdermaid
nmcdermaid

You may have more luck using the window FTP client.

Firstly verify that the windows FTP has the functionality you need, by doing start/Run/CMD and experimenting with this syntax:

FTP << [your script file]

If you manage to get it to do what you want, then just drop the CMD syntax into an Execute Process Task in your DTS package.



If this is all you are doing in the DTS then you are probably better off doing it directly in a job
I agee, use the command stage in DTS and use the "DOS" ftp with the -s option and a command file.
SOLUTION
Avatar of mcmonap
mcmonap
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LuckyLucks

ASKER

w.r.t mcmonap's msg:
   Is there a modifiaction that I should be making to the command file s.t it retreives all files without expecting a yes. The reason is that I dont know how many files there might be beforehand.

Thanks
Also what is the -s for?

thanks
Hi LuckyLucks,

I think adding a /Y retrieves files without requiring entry, the -s specifies the script file to use.

myusername
mypassword
mget *.* /Y
quit
actually the /Y doent help. It does the first entry and then asks again for the second entry.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial