Skip to content

Instantly share code, notes, and snippets.

@teolaz
Created December 12, 2018 11:00
Show Gist options
  • Save teolaz/90be8200ea1d44bba0a2b52d37be4872 to your computer and use it in GitHub Desktop.
Save teolaz/90be8200ea1d44bba0a2b52d37be4872 to your computer and use it in GitHub Desktop.
Rsync to a remote server seeing percentage
#!/bin/sh
echo "rsync starting..."
SOURCE_DIR="/source/dir/with/final/backslash/"
TARGET_ADDRESS="127.0.0.1"
TARGET_DIR="/dir/with/final/backslash/"
TARGET_USER="remote-ssh-user"
RSYNC_ARGS='-vrltD --delete --stats --human-readable'
TODO=$(find ${SOURCE_DIR} | wc -l)
echo "found ${TODO} files, syncing..."
rsync ${RSYNC_ARGS} ${SOURCE_DIR} ${TARGET_USER}@${TARGET_ADDRESS}:${TARGET_DIR} | pv -l -e -p -s "$TODO"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment