Delete directories without browsing them

Matthias Schniedermeyer ms at citd.de
Sun Apr 7 05:29:55 MDT 2013


On 07.04.2013 11:25, AZ 9901 wrote:
> Le 6 avr. 2013 à 17:15, Matthias Schniedermeyer a écrit :
> 
> > On 06.04.2013 16:57, AZ 9901 wrote:
> >> 
> >> Is there a way to tell Rsync to directly delete backup directories at
> >> the top of the hierarchy without browsing them ?
> > 
> > No.
> > 
> > Deleting a directory-tree has to be done "file by file" and "directory 
> > by directory" there is no magic "remove that mountain of files"(*).
> > 
> 
> Matthias, thank you for your answer !
> 
> I made some tests, I created a directory with 300k files in it.
> I deleted it with Rsync, then with rm command.
> I did this test several times.
> On my server, it took about 20 seconds with rm, about 40 seconds with Rsync.
> 
> In the Rsync deamon logfile, I can see a "del." line for each file of the directory, beginning from the top down.
> Does Rsync compares each file against the incl/excl list to know if it can be deleted ?

Unfortunatly i don't know.

> If so, is there a way to tell Rsync the following ?
> "delete this top directory and all its files, but stop lacking time with comparisons against the incl/excl list for each element of this top directory"
> 
> Certainly that it could speed up deletion with Rsync :-)

Possibly it's just overhead that slows down rsync.
rm only does deletion, rsync can do much more so the code-path are 
longer.

As an example, the absolut maximum bandwith i can reach with rsync while 
copying files is about 230MB/s, even on a tmpfs where cp can copy with 
several GB/s.

I just tried a 8GB file on tmpfs. cp took 2.5 seconds, that is over 
3GB/s.

But i'm just guessing.



-- 

Matthias


More information about the rsync mailing list