I am creating a script on the fly to ftp some files from a remote computer. I create a file which is then called from the command line with
ftp -s:filename proxy
where filename is the file I just created. The file has code similar to the following:
anonymous@ip address
username
prompt off
binary
cd c:\destination directory
mget c:\source directory\*.*
quit
That doesn't work. Neither does the following:
anonymous@ip address
username
prompt off
binary
cd c:\source directory
mput c:\destination directory
quit
Obviously, I'm not so good at ftp. How, in what order, where in my file do I specify the place where I want the files to be put (destination directory, and also from where the ftp process is running), and where I want the files to come from (ip address computer which has files I want). Do I need to set the directory before starting the ftp process?
I'm running this in an SSIS package, and I'm not using the SSIS ftp task, because I don't want a failure if no files are found. If there's nothing there, that's cool. If there is something there, I want a copy.
(It was working in my development area, and now, when I'm trying to get files from a server that I truely have no access to except ftp, I'm not getting anything. See http://stackoverflow.com/questions/140850/the-best-way-for-a-ssis-ftp-task-to-not-fail-when-there-are-no-files-to-copy for an earlier, related question.)
Update: Both of the answers below, listing lcd and cd, are correct. However, my example still failed, until I replaced the backslashes with forward slashes. In other words, my final, working result is as follows:
anonymous@ip address
username
prompt off
binary
lcd /destination directory
cd /source directory
mget *.*
quit