Delete directories without browsing them

AZ 9901 az9901 at gmail.com
Sat Apr 6 08:57:44 MDT 2013


Hello,


I make my production backups with Rsync.


Here is an example of my backup tree on the destination server :
  /backups
    /2013-04-03
    /2013-04-02
    /2013-04-01
    /2013-03-31
    /2013-03-30
    /2013-03-29

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 :
  + /2013-04-03
  + /2013-04-03/logfile.log
  - /2013-04-03/*
  - /2013-04-02
  - /2013-04-01

I also use this empty directory where my logfile is :
  /tmp
    /path
      /2013-04-03
        /logfile.log

And I run this rsync command :
  rsync -a --delete-after --exclude-from=inclexcl.txt /tmp/path/
myserver::backups/

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 !

Best regards,

Ben


More information about the rsync mailing list