Download all Files from FTP site via Batch, but place in another network share.

D

DonInPhx

OK Here is what I an trying to do.
I have a new process to put in place for a bi-monthly download.
What I want to do via command line is go to the FTP site, then
mget *.*....... However, what is happening is they are always being
downloaded to the location I am executing the script from. What I
want to do is have those files sent to another location on the same
machine. Here is the format I have, but I cannot get it to work.

My .Bat file...

@Echo On
Echo *****************************************
Echo * Get Files From FTP Server*
Echo *****************************************
ftp -s:C:\Testing\MyFileParameters.txt -n -i
rem Echo *********************************
rem Echo * Copying files to new folder *
rem Echo *********************************
Echo * Process COMPLETE! *
Echo *******************************
pause
exit

The MyFileParameters.txt file..

open 192.1.xxx.xxx
user username
mypassword
mget *.*
lcd \\ServerName\H:\Share\DirectoryToCopyTo\
bye


No matter what I cannot get the lcd command working. Where am I missing
the boat?
 
P

Pegasus \(MVP\)

DonInPhx said:
OK Here is what I an trying to do.
I have a new process to put in place for a bi-monthly download.
What I want to do via command line is go to the FTP site, then
mget *.*....... However, what is happening is they are always being
downloaded to the location I am executing the script from. What I
want to do is have those files sent to another location on the same
machine. Here is the format I have, but I cannot get it to work.

My .Bat file...

@Echo On
Echo *****************************************
Echo * Get Files From FTP Server*
Echo *****************************************
ftp -s:C:\Testing\MyFileParameters.txt -n -i
rem Echo *********************************
rem Echo * Copying files to new folder *
rem Echo *********************************
Echo * Process COMPLETE! *
Echo *******************************
pause
exit

The MyFileParameters.txt file..

open 192.1.xxx.xxx
user username
mypassword
mget *.*
lcd \\ServerName\H:\Share\DirectoryToCopyTo\
bye


No matter what I cannot get the lcd command working. Where am I missing
the boat?

You have two problems in your script:
- AFAIK, lcd does not support UNC paths.
- lcd requires forward slashes, not back slashes

You must change into the target directory ***before*** launching ftp.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top