cmd file for FTP commands?

J

James

I was wanting to setup a cmd or bat file to connect to a remote server and move whatever folders are there from the remote system to my system. I want to be able to use windows task manager to schedule it every morning at a certain time. Since the folder names are going to change, I cannot put a specific folder name on it. Is a cmd or bat file the best way to go or is there an easier way of doing it?

Thanks in advance,
James B.
 
K

Klaus Jorgensen

James wrote on 10-11-2008 :
I was wanting to setup a cmd or bat file to connect to a remote server and
move whatever folders are there from the remote system to my system. I want
to be able to use windows task manager to schedule it every morning at a
certain time. Since the folder names are going to change, I cannot put a
specific folder name on it. Is a cmd or bat file the best way to go or is
there an easier way of doing it?

If the folder names changes from one day to another, how would a script
be able to distinguish them from the rest - that is, if other folders
should not be copied?
Please be more specific - or give an example.
 
J

James

Ok could I copy all of the folders then delete them from the remote server?
The end result is to "move" (or copy and delete) the folders that are being
put there every morning and get them to my system. The folder are an export
for another program for a differnent company we do business with.
 
K

Klaus Jorgensen

James expressed precisely :
Ok could I copy all of the folders then delete them from the remote server?
The end result is to "move" (or copy and delete) the folders that are being
put there every morning and get them to my system. The folder are an export
for another program for a differnent company we do business with.

The FTP client in Windows XP copies files from one folder at a time,
there is no xcopy funtion.
I think your best option would be a zipped file created on the remote
system with all the files/folders in it, meaning one file only to copy.
The file name of the zipped file could be created from the system date.
An ftp script for this would be very simple.
 
R

Rick Merrill

Klaus said:
James expressed precisely :

The FTP client in Windows XP copies files from one folder at a time,
there is no xcopy funtion.
I think your best option would be a zipped file created on the remote
system with all the files/folders in it, meaning one file only to copy.
The file name of the zipped file could be created from the system date.
An ftp script for this would be very simple.

Suppose the folders are named with a datestamp - the OP could have a
small program that would anticipate the datestamp and poop out a batch
file for the FTP program. The latter would always have the same name so
the program would be run automaticly as a scheduled task.

So you wind up scheduling 2 program to run in staggered fashion: one
creates the file for the other.
 
J

James

can you recommend any third party software that will do what I want? It
seems as if I'm making Microsoft do more than it's made to do
 
K

Klaus Jorgensen

James presented the following explanation :
It seems as if I'm making Microsoft do more than it's made to do

Not at all - I did something similar a couple of years back.
Using the datestamp as part of the zipped file is optional - use it if
you need some sort of historical data (and if there are no problems
with disk quota/space at both systems).
See if the examples below makes any sense.
(In batch scripts, I'm always using variables to define file locations
- it makes things easier if they to be changed later on.)


---At the remote end, a bat file could look like this:
set zippgm="%PROGRAMFILES%\WinZip\WinZip32.exe"
set zipfname="C:\ftproot\james\DataFiles%DATE:~0,2%.zip"
set datfiles="C:\DataFiles\*.*"
%zippgm% -a -p -r %zipfname% %datfiles%

---At your end:
set ftpcmd=C:\DataFiles\getdata.ftp
set zipfname=DataFiles%DATE:~0,2%.zip
echo ftp.remotesite.com >%ftpcmd%
echo username >>%ftpcmd%
echo password >>%ftpcmd%
echo bin >>%ftpcmd%
echo cd james >>%ftpcmd%
echo get %zipfname% >>%ftpcmd%
echo bye >>%ftpcmd%
ftp -s:%ftpcmd%
 

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