Delete directories without browsing them
az9901 at gmail.com
Sat Apr 6 08:57:44 MDT 2013
I make my production backups with Rsync.
Here is an example of my backup tree on the destination server :
At the end of the backup process, I upload a logfile in the backup
directory and delete oldest backups.
For this, I use an include/exclude file, for example this inclexcl.txt :
I also use this empty directory where my logfile is :
And I run this rsync command :
rsync -a --delete-after --exclude-from=inclexcl.txt /tmp/path/
Perfect, it works, my logfile is uploaded and oldest backups are
deleted (in this example all backups of March).
However, what I can see in the daemon log is that Rsync is browsing
from the top down all files of the backup directories to delete, and
delete them one by one.
As each of my backup directories contains hundreds of thousands of
files, deletion take a very long time and eats a lot of IOs.
Is there a way to tell Rsync to directly delete backup directories at
the top of the hierarchy without browsing them ?
Thank you very much for your support !
More information about the rsync