Re: [Hampshire] Rsync question

Top Page

Reply to this message
Author: Damian Brasher
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Rsync question
Vic wrote:

> rsync is a little peculiar in how it does its exclude patterns; they need
> to be the pattern rsync sees, not the absolute pathname. So you woud want
> something along the lines of "--exclude=/zunk". Use the -v option to show
> you the patterns you've got...


As a foot note - if using an absolute pathway then a trailing / is needed
unless you are pointing to a filename not a directory (although I have
never excluded a single file). the --exclude option will also listen to ~/
(home directory) prefix without double quotes.

So

rsync -av --exclude=/mnt/sdb1/zunk/ --delete /mnt/sdb1/ /mnt/sdc1/backups/

Should be OK.

To keep track of the files you archive and delete, as the 'a' switch is a
combination of switches designed to optimize rsync operation for archiving
(-rlptgoD), at little cost you can add a log file...

rsync -av --exclude=/mnt/sdb1/zunk/ --delete
--log-file=/mnt/sdb1/rsync_log /mnt/sdb1/ /mnt/sdc1/backups/

Lee Lawrence wrote:

>rsync -av --exclude="zunk/**" --delete /mnt/sdb1/ /mnt/sdc1/backups


Would this be OK, I wonder, if a directory you wanted to archive was a
sub-directory of ../sdb1/../.. was also named zunk? I have generally
avoided using pattern matches like this just in case.

Vic wrote:

>--delete is the option you want; I don't know if --delete-after implies

it...

The --delete and --delete-before remove files on the receiving location
that are no longer located on the sending location before continuing
archiving of the remainder of the files - these are the same default
option.

Damian

--
Damian L Brasher
http://www.diap.org.uk