Ubuntu – rsync delete files

The rsync alternative!

rsync is without doubt one of the most handy commands when it comes to file operations. Rsync can do any kind of volume sync – as you may know – but it also provides a way to empty a folder.
The example below assumes you have a folder named /tmp/empty/ which contains no files, and a folder /tmp/session/ that contains too much crap. The rule below allows you to remove those files:

rsync -a --delete /tmp/empty /tmp/session/

Similar Posts