Last active
April 22, 2018 14:39
-
-
Save brunopadz/603e00850854e8038d326958ea53361c to your computer and use it in GitHub Desktop.
Simple shell script to copy files over ssh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FILES=source_dir/*BACKUP* | |
for f in $FILES | |
do | |
echo "Copying $f at `date`" >> copy.log | |
scp -i key.ppk -p $f user@hostname:/destination_dir | |
if [ "$?" = 0 ]; then | |
echo "$f copy has finished at `date`" >> copy.log | |
else | |
echo "Error while trying to copy $f" >> error.log | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment