Last active
October 7, 2015 23:32
-
-
Save chrisb13/7ea4e9620cbce4a80bfd to your computer and use it in GitHub Desktop.
Bash function for painless rsync.
This file contains hidden or 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
function servername_pull() | |
{ | |
if [[ ( $# -eq 0 ) || ( $1 == "--help" ) || ( $1 == "-h" ) ]] ; then | |
echo "Usage: servername_pull PATH_FROM PATH_TO." | |
echo "Purpose: rsync function to pull files from servername." | |
echo " " | |
echo "Mandatory arguments: " | |
echo "PATH_FROM: Path on server to Rsync from" | |
echo "PATH_TO: Path on local to Rsync to" | |
echo " " | |
echo "Example." | |
echo "This:" | |
echo "servername_pull /home/server/path/*.py ./temp" | |
echo " " | |
echo "Becomes:" | |
echo "rsync -avz --progress [email protected]:/home/server/path/*.py ./temp" | |
return 1 | |
fi | |
rsync -avz --progress [email protected]:$* | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment