script to FTP a file to another server - making backup of the current one first

I need a script that will FTP a file to another UNIX server.  In addition to this I will need to have the file that is about to be over written to be copied to a timestamped backup.

Any suggestions/examples on how to accomplish this?

Thanks,

Lisa
lphillips120898Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
MikeOM_DBAConnect With a Mentor Commented:
Try this:

#!/bin/ksh

FTP_SITE=111.222.333.444
TODAY=$(date +%Y%m%d)
export FTP_SITE  TODAY

ftp -nv $FTP_SITE <<EOF
user <user_id> <password>
binary (or ascii)
rename <old file> <old file>$TODAY
put <new file>
quit
EOF
0
 
lphillips120898Author Commented:
I posted this in the wrong area... I'm now going to post this in the UNIX section.

Sorry...

Lisa
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.