Getting rsync to delete files from the *sender* after transfer

5,554

(answering my own question here :) )

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

Share:
5,554

Related videos on Youtube

Araejay
Author by

Araejay

Updated on September 17, 2022

Comments

  • Araejay
    Araejay over 1 year

    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?

  • shgnInc
    shgnInc over 9 years
    Thank you. By this option files just delete. How to delete directories with file deletion?
  • sbussetti
    sbussetti about 3 years
    @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.