Skip to content

Instantly share code, notes, and snippets.

@rsnemmen
Created February 5, 2018 16:28
Show Gist options
  • Select an option

  • Save rsnemmen/747a6f7d7d52738d91a47faad730062f to your computer and use it in GitHub Desktop.

Select an option

Save rsnemmen/747a6f7d7d52738d91a47faad730062f to your computer and use it in GitHub Desktop.
Syncs the content of the current directory with a remote server using rsync via SSH
#!/bin/sh
#
# Syncs the content of the current directory with a remote server using rsync
# via SSH.
#
# Usage: csync.sh <user@remoteserver> <remote path where directory will be synced>
#
# Example: csync.sh nemmen@alphacrucis pluto
# check if there were command-line arguments
if [ $# -eq 0 ]; then
echo "Usage: "
echo " csync.sh <user@remoteserver> <remote path where directory will be synced> "
exit 1
fi
rsync -va -e ssh --progress --delete . $1:$2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment