1748225 Members
4524 Online
108759 Solutions
New Discussion юеВ

Re: Batch scripting help

 
krackjack
New Member

Batch scripting help

How to write a batch script in order to ftp the files from remote machine.
4 REPLIES 4
OldSchool
Honored Contributor

Re: Batch scripting help

very broad question with multiple possible answers....

one way, if netrc files are setup so you don't need id / password

ftp *othermachine* <cd /somedirectory
get somefile
bye
EOF


Rita C Workman
Honored Contributor

Re: Batch scripting help

Or if you didn't set up .netrc file:

ftp <<-EOF
user
ls
get
bye
EOF

Or....just type "auto ftp" or some variation of this in Search option above. Dozens of scripts for this have been posted here.

Rgrds,
Rita
Dennis Handly
Acclaimed Contributor

Re: Batch scripting help

>Rita: ftp <<-EOF
>user

If you are going to use this form, you need the -n option.
OldSchool
Honored Contributor

Re: Batch scripting help

also, you'll need to log the ftp results and parse them to determine success or failure, as you can't check for $0 being OK (it will be 0 even if the get fails...because the "bye" worked...)



ftp *othermachine* > /somepath/myftp.log <cd /somedirectory
get somefile
bye
EOF