From Notepedia
Jump to: navigation, search

Rsync over ssh and delete/update existing files that match the source to the targer

rsync -aumvv --delete /my/music/library/*

that way i tell rsync to sync via ssh. You need an ssh server running on the target machine ( in my case) and have rsync installed on both machines.

Here's an explanation if the options:

  • -a: List item archive all files (include options rlptgoD)
  • -u: update existing files, don't copy them again if they are already in place
  • -m: prune empty dirs
  • --delete: delete files on target which were deleted on source

inherited through flag -a:

  • -r: recurse through subdirs
  • -l: preserve symlinks as symlinks
  • -p: preserve permissions
  • -t: preserve modification time
  • -g: preserve group
  • -o: preserve owner
  • -D: preserve device and special files

Rsync over ssh non standard port

rsync -av -e 'ssh -p 2200' --ignore-existing  --progress [email protected]:~/source/ ~/target/
  • -a: List item archive all files, as above
  • -v: Verbose
  • -e: Remote shell to use
  • ssh -p xxxx: Specify remote port to transfer over ssh
  • --ignore-existing: Skip updating files that exist on receiver
  • --progress: Show progress during transfer