Does rsync delete unmatched files by default?

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Mon Jan 3 22:40:49 UTC 2011


On Mon, Dec 20, 2010 at 06:48:39PM -0500, Walter Dnes wrote:
>   I think the answer is "no", as long as I don't specify --delete, but I
> want to confirm.  I revently switched over to using rsybc to back up my
> main machine to an external USB drive.  It took a while <G> because it
> was the first pass so it amounted to a straight copy.
> 
>   My question is about future backups.  If I delete a file from the
> source, will it be deleted from the destination during my next sync?
> The script I use is below...
> 
> #!/bin/bash
> rm /root/rsync_log.txt
> cd /
> rsync --archive --group --itemize-changes --links --owner --perms \
>       --progress --recursive --stats --times --verbose \
>       --files-from=root/include_rsync.txt \
>       --exclude-from=root/exclude_rsync.txt \
>       --log-file=/root/rsync_log.txt / /mnt/extd/image_i3/

It does NOT delete excluded files on the target, unless you also add
--delete-excluded.  But otherwise it does delete things that are not
on the source when --delete is specified.  If no --delete option is
specified at all, it only modifies or adds files.  Tends to cause a mess
of a backup after a while littered with obsolete deleted files.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list