Solved

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

Posted on 2002-06-27
2
209 Views
Last Modified: 2013-12-15
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
0
Comment
Question by:lphillips120898
2 Comments
 

Author Comment

by:lphillips120898
ID: 7114226
I posted this in the wrong area... I'm now going to post this in the UNIX section.

Sorry...

Lisa
0
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 200 total points
ID: 7122825
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

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
wifi not working on Raspberry Pi 3? 2 85
Setting up static IP - Ubuntu server 16.04 12 100
winscp where are logs stored 3 52
Apache module 5 48
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question