Skip to content

Instantly share code, notes, and snippets.

@prochor666
Forked from AtumRa/rsync delete command.md
Created September 25, 2020 09:26
Show Gist options
  • Save prochor666/8ba26d636163b65a61ec56000bac4535 to your computer and use it in GitHub Desktop.
Save prochor666/8ba26d636163b65a61ec56000bac4535 to your computer and use it in GitHub Desktop.
rsync deleting files without copy

Rsync delete orphan files from target only - no copy

Calling Rsync in the following way, using --existing, --ignore-existing and --delete enables the following:

  • Only files at target that do not exist at source will be deleted.
  • Skipping all file copy operations from source to target.
$ rsync -ri \
  --delete --existing --ignore-existing --progress \
  /path/to/source/ /path/to/target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment