Skip to content

Instantly share code, notes, and snippets.

@chrisb13
Last active October 7, 2015 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisb13/7ea4e9620cbce4a80bfd to your computer and use it in GitHub Desktop.
Save chrisb13/7ea4e9620cbce4a80bfd to your computer and use it in GitHub Desktop.
Bash function for painless rsync.
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 server_username@server.address.edu.au:/home/server/path/*.py ./temp"
return 1
fi
rsync -avz --progress server_username@server.address.edu.au:$*
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment