Skip to content

Instantly share code, notes, and snippets.

@bsmith89
Created June 6, 2019 18:29
Show Gist options
  • Save bsmith89/f1e1678681fa825d5996eb822dd744d0 to your computer and use it in GitHub Desktop.
Save bsmith89/f1e1678681fa825d5996eb822dd744d0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
remote='<PROJECT_PATH_HERE>'
for path in $@
do
dirname=$(dirname $path)
basename=$(basename $path)
mkdir -p "$dirname"
# Use rsync --partial for restartable transfers.
partialdir=$TMPDIR/rsync-tmpdir/$remote/$dirname
mkdir -p "$partialdir"
rsync -hravz -P --partial-dir="$partialdir" <SERVER_NAME>:$remote/$path "$dirname"
done
@bsmith89
Copy link
Author

bsmith89 commented Jun 6, 2019

Be sure to replace <PROJECT_PATH_HERE> and <SERVER_NAME> with the path to your project directory on the remote server, and the name of the remote server, respectively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment