more questions Re: deleting (empty) directories

my old address lucio at
Thu Oct 3 12:25:00 EST 2002

Thanks to Tim Conway and Phil Marek. The correct way(s) to synchronize two
directory trees is to avoid a trailing "*" after the origin directory
(either use a . or nothing)

rsync -rlptPzu --delete /scratch/temp/Departure/. /scratch/temp/Arrival/
rsync -rlptPzu --delete /scratch/temp/Departure/  /scratch/temp/Arrival/

I was misled by my first tests
rsync -rlptPzu --delete /scratch/temp/Departure  /scratch/temp/Arrival
which created Arrival/Departure and over-did it adding /* to Departure.

Actually running with -vvv and looking at the output explained all.

Three more questions :

1) about --delete-after

   Is it correct that if I want to use this option (deleting files
   only after all copies) I have to use BOTH --delete --delete-after ?

   At least in my cases it works only that way (but from the manual
   I'd assumed one or the other options were sufficient)

2) what is the clean way to stop a daemon ?

   I proceeded to further tests using a rsync daemon (run as a user
   on a non-privileged port).  Once the daemon is up, I see that I
   can stop it by "kill `cat`".

   But this logs in rsync.log a message like
   rsync error: received SIGUSR1 or SIGINT (code 20) at rsync.c(229)

   It works, but the message is unelegant. Is there a proper way of
   stopping a daemon ?

3) selective delete ?

   I am now testing a way to keep in synch two nearly mirrored sites.

   I planned to run with rsync -rlptzu --delete source destination

   The source is a module defined in a configuration file. This contains
   an exclude directive like this :

   exclude=/Local/* /.htaccess /Query/Private /Query/Admin/*

   what I want to achieve is three-fold :

   a) my .htaccess file, my "Private" soft-link and the content of
      the Local and Admin directories are not propagated to destination
      (and this works for initial population)

   b) any file which has been deleted on the source, shall also be
      deleted on the destination

   c) but the excluded files (.htaccess, a specific site-dependent
      Private link, and the content of the Local subdirectory)
      shall NOT BE DELETED. These are intended to exist on each
      mirror but be customized in a site specific way !

      How can I achieve this ? I thought that using --delete without
      --delete--excluded would do it, instead any of the files which
      are "customized" on the destination get deleted !

      Is there an easy way to do this ? (A silly one would be to
      mirror separately only the other subdirectories one by one
      explicitly ...)

Lucio Chiappetti - IASF/CNR - via Bassini 15 - I-20133 Milano (Italy)
"This land .. is my land .. e no xe una portaerei"
[English in the original]  [and is not an aircraft carrier]
                             M.Paolini - I cani del gas - Bestiario italiano
For more info :



For more info :

More information about the rsync mailing list