Francis.Montagnac at inria.fr
2015-Apr-13 17:34 UTC
How to discern when like dir names exist in 2 places
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' Francis
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I was actually in the include/exclude section of the man page not the filter section. However, your syntax does work. The +/- syntax absolutely works in an --exclude-from or --include-from file I use it all the time. However, apparently the -/ syntax does not work there. So, I am not sure if the man page is wrong or if this feature just isn't working correctly in an exclude file. - From the man page: INCLUDE/EXCLUDE PATTERN RULES ... The following modifiers are accepted after a "+" or "-": o A / specifies that the include/exclude rule should be matched against the absolute pathname of the current item. For example, "-/ /etc/passwd" would exclude the passwd file any time the transfer was sending files from the "/etc" directory, and "-/ subdir/foo" would always exclude "foo" when it is in a dir named "subdir", even if "foo" is at the root of the current transfer. On 04/13/2015 01:34 PM, Francis.Montagnac at inria.fr wrote:> > 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' > > Francis >- -- ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~ 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 iEYEARECAAYFAlUsAK4ACgkQVKC1jlbQAQeCAQCeIiW4DaQHh41XAbbIRjUqUmfG 5dUAn3w7EpsV99alLhUffL/m2H69iDnU =EL0B -----END PGP SIGNATURE-----
Francis.Montagnac at inria.fr
2015-Apr-13 18:02 UTC
How to discern when like dir names exist in 2 places
On Mon, 13 Apr 2015 13:45:18 -0400 Kevin Korb wrote:> The +/- syntax absolutely works in an --exclude-from or --include-from > file I use it all the time. However, apparently the -/ syntax does > not work there.> So, I am not sure if the man page is wrong or if this feature just > isn't working correctly in an exclude file.This is perhaps this note in the "FILTER RULES" section: Note that the --include/--exclude command-line options do not allow the full range of rule parsing as described above -- they only allow the specification of include/exclude patterns plus a "!" token to clear the list (and the normal comment parsing when rules are read from a file). -- Francis
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.
-----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-----
Seemingly Similar Threads
- How to discern when like dir names exist in 2 places
- How to discern when like dir names exist in 2 places
- How to discern when like dir names exist in 2 places
- How to discern when like dir names exist in 2 places
- How to discern when like dir names exist in 2 places