HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

Batch scripting help

 
krackjack
Occasional Visitor

Batch scripting help

How to write a batch script in order to ftp the files from remote machine.
4 REPLIES
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

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