12

I'm using rsync to move one directory to another. Is there some way to get rsync to incrementally delete a file from the sender after it has copied it to the reciever?

Amandasaurus
  • 31,471
  • 65
  • 192
  • 253

1 Answers1

18

(answering my own question here :) )

The --remove-source-files will do this. :)

Amandasaurus
  • 31,471
  • 65
  • 192
  • 253
  • 2
    Thank you. By this option files just delete. How to delete directories with file deletion? – shgnInc Jan 11 '15 at 06:04
  • @shgnInc -- there's no option in rsync that will prune the empty directories for you. Use something like `find /your/path -type d -empty -exec rm -rf {} \;` after rsync is done to prune empty directories. – sbussetti May 16 '21 at 15:20