Skip to content

Instantly share code, notes, and snippets.

@manishrjain
Last active January 26, 2022 00:39
Show Gist options
  • Save manishrjain/df84a0a9967c13604d34 to your computer and use it in GitHub Desktop.
Save manishrjain/df84a0a9967c13604d34 to your computer and use it in GitHub Desktop.
rsync two local folders
# rsync src folder to dest folder
# -r = recursive
# -t = preserves times
# -v = verbose
# -u = Instead of blind copy, check if file already exists, and update it
# -c = Skip files based on checksum, not mod-time & size (expensive)
# -a = Archive mode, preserves symbolic links (useful).
# -h = human mode
# --progress to show progress and ETA.
#
# trailing slashes are important because with them "src" folder doesn't get
# created inside dst folder, like so -> dst/src. Instead src/* -> dst/*.
rsync -rtvuc --delete src/ dst/
# If sending data over network or between drives, also consider using
# -z option, which would compress data before transfer.
rsync -rtvucz --delete src/ -e ssh server:/dst/
# Restart them in case of temporary network errors, until they exit
# successfully.
until !!; do :; done
@manishrjain
Copy link
Author

Disk usage with ncdu.

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