How to discern when like dir names exist in 2 places

Kevin Korb kmk at sanitarium.net
Mon Apr 13 19:25:18 MDT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When I was testing I had a filter file that contained:
- -/ /etc/passwd

The commands I was testing with were:
rsync -vvaiinx --filter="merge filterfile.txt" /etc/ /tmp/ | grep passwd
and
rsync -vvaiinx --filter="merge filterfile.txt" / /tmp/ | grep passwd

In both commands /etc/passwd was skipped.  With just - instead of -/
the file was only skipped on the second command.

On 04/13/2015 09:17 PM, Harry Putnam wrote:
> Francis.Montagnac at inria.fr writes:
> 
>> Hi,
>> 
>> On Mon, 13 Apr 2015 12:59:07 -0400 Kevin Korb wrote:
>>> Hmmm,  according to my interpretation of the man page (I am on
>>> 3.1.1) that is supposed to work however when I test using the
>>> "-/ /etc/passwd" example the / seems to have the same effect as
>>> commenting the line.  I get /etc/passwd copied whether the
>>> source is / or /etc.
>> 
>> I guess that this -/ syntax is not usable with --exclude, but
>> only with --filter.
>> 
>> Try thus to modify your exclude file to:
>> 
>> - /pkg/* - /sadm/* - /cache/* - /opt/csw/cache/* -/
>> /var/apache2/* - /tmp/*
>> 
>> an call rsync ... --filter='merge YOUR_FILE'
> 
> I probably should have posted my OP on the rsnapshot list since
> that is how this is being done here.
> 
> I did mention that early on.
> 
> I'm not sure how I would arrange to run rsync as suggested in an 
> rsnapshot script.
> 
> I tried this:
> 
> Comment out all mention of an exclude file
> 
> Then, where you are to set the arguments to rsync you are supposed
> to give both short and long like so:
> 
> rsync_short_args  HERE rsync_long_args   HERE
> 
> (The white space before HERE is reqiured to be a tab)
> 
> So I tried to use your suggestion by placing it in the long_arg 
> section like so:
> 
> -------       -------       ---=---       -------       ------- 
> rsync_long_args   --filter="merge
> /etc/rsnap/ex/rsnap_2xsMisc_exclude"  --stats --delete
> --numeric-ids --delete-excluded -------       -------       ---=---
> -------       -------
> 
> (The file listed there (/etc/rsnap/ex/rsnap_2xsMisc_exclude)
> contains your suggestion)
> 
> All those annotated like this:
> 
> - /dir/*
> 
> Are excluded, but in both runs... that is, any files below
> /etc/dir/ and /var/dir/ are excluded.
> 
> the one line annotated like:
> 
> -/ /var/apache2/*
> 
> Appears to just be ignored... and any files under /etc/apache2 or 
> /var/apache2 are INCLUDED.
> 
> 
> I'm beginning to get myself confused... but I suspect I should
> move this query to the rsnapshot group and include a pointer to
> this thread.
> 

- -- 
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
	Kevin Korb			Phone:    (407) 252-6853
	Systems Administrator		Internet:
	FutureQuest, Inc.		Kevin at FutureQuest.net  (work)
	Orlando, Florida		kmk at sanitarium.net (personal)
	Web page:			http://www.sanitarium.net/
	PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUsbH4ACgkQVKC1jlbQAQeznQCg4HYlu1npsK6xS1FxmDagCwd0
/roAn3G0Z+zd0zvCoNfqcW89/LdHCBDx
=FEAW
-----END PGP SIGNATURE-----


More information about the rsync mailing list