|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Yet another include/exclude questionHi,
How can I include only *.foo and *.bar files in an rsync? To make it a bit more difficult: Those files can be anywhere in the directory structure. I've been reading and trying for a while but the best I got is all *.foo and *.bar files in ./ but none of the ones inside any directories. Cheers, Tom -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html |
|
|
Re: Yet another include/exclude questionThere is an example in the man pages for *.c files that will do what you want. Try: --include=*/ --include=*.foo --exclude=* On Nov 6, 2009, at 12:43 AM, Thomas Gutzler wrote: > Hi, > > How can I include only *.foo and *.bar files in an rsync? > To make it a bit more difficult: Those files can be anywhere in the > directory structure. > > I've been reading and trying for a while but the best I got is all > *.foo and *.bar files in ./ but none of the ones inside any > directories. > > Cheers, > Tom > -- > Please use reply-all for most replies to avoid omitting the mailing > list. > To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html |
|
|
Re: Yet another include/exclude questionTony wrote:
> On Nov 6, 2009, at 12:43 AM, Thomas Gutzler wrote: >> Hi, >> >> How can I include only *.foo and *.bar files in an rsync? >> To make it a bit more difficult: Those files can be anywhere in the >> directory structure. >> >> I've been reading and trying for a while but the best I got is all >> *.foo and *.bar files in ./ but none of the ones inside any >> directories. > > There is an example in the man pages for *.c files that will do what you > want. > > Try: --include=*/ --include=*.foo --exclude=* Yes. I would also strongly recommend the section of the man page that describes "--prune-empty-dirs". Cheers, -SM -- -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html |
|
|
Re: Yet another include/exclude questionWhat if I also want to include everything in /this_dir/ without running
two instances and still being able to use --delete? I thought --include="/this_dir/" --include="/this_dir/***" would do it, but it doesn't. The exclude * seems to overwrite the include matches: [sender] hiding file this_dir/foo because of pattern * Tom Steven Monai wrote: > Tony wrote: >> On Nov 6, 2009, at 12:43 AM, Thomas Gutzler wrote: >>> Hi, >>> >>> How can I include only *.foo and *.bar files in an rsync? >>> To make it a bit more difficult: Those files can be anywhere in the >>> directory structure. >>> >>> I've been reading and trying for a while but the best I got is all >>> *.foo and *.bar files in ./ but none of the ones inside any >>> directories. >> There is an example in the man pages for *.c files that will do what you >> want. >> >> Try: --include=*/ --include=*.foo --exclude=* > > Yes. I would also strongly recommend the section of the man page that > describes "--prune-empty-dirs". > > Cheers, > -SM > -- -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html |
|
|
Re: Yet another include/exclude questionOn Sun, Nov 8, 2009 at 10:21 PM, Thomas Gutzler <thomas.gutzler@...> wrote: ..wayne..I thought --include="/this_dir/" --include="/this_dir/***" would do it, Order is important. Whatever matches first, is what takes effect. Also, *** matches both the dir and its contents, so you could use: --include='/this_dir/***' --exclude=* As long as "this_dir" is in the root of the transfer, that will work. -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html |
|
|
Re: Yet another include/exclude questionThanks everyone for your help, I've got what I want.
Wayne Davison wrote: > On Sun, Nov 8, 2009 at 10:21 PM, Thomas Gutzler > <thomas.gutzler@... <mailto:thomas.gutzler@...>> wrote: > > I thought --include="/this_dir/" --include="/this_dir/***" would do it, > but it doesn't. The exclude * seems to overwrite the include matches: > [sender] hiding file this_dir/foo because of pattern * > > > Order is important. Whatever matches first, is what takes effect. > Also, *** matches both the dir and its contents, so you could use: > > --include='/this_dir/***' --exclude=* It seems to be very picky about the order. Thanks for pointing that out. My first attempt has been --include="*/" --include="*.foo" --include="*.bar" --include="/this_dir/***" --exclude="*" which did nothing than *.foo and *.bar. Shuffling it around, I found that --include="*/" --include="/this_dir/***" --include="*.foo" --include="*.bar" --exclude="*" does what I want and it even makes sense. Cheers, Tom -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html |
|
|
Re: Yet another include/exclude questionOn Tue, 2009-11-10 at 09:45 +0800, Thomas Gutzler wrote:
> Thanks everyone for your help, I've got what I want. > > Wayne Davison wrote: > > On Sun, Nov 8, 2009 at 10:21 PM, Thomas Gutzler > > <thomas.gutzler@... <mailto:thomas.gutzler@...>> wrote: > > > > I thought --include="/this_dir/" --include="/this_dir/***" would do it, > > but it doesn't. The exclude * seems to overwrite the include matches: > > [sender] hiding file this_dir/foo because of pattern * > > > > > > Order is important. Whatever matches first, is what takes effect. > > Also, *** matches both the dir and its contents, so you could use: > > > > --include='/this_dir/***' --exclude=* > > It seems to be very picky about the order. Thanks for pointing that out. > My first attempt has been > --include="*/" --include="*.foo" --include="*.bar" > --include="/this_dir/***" --exclude="*" > which did nothing than *.foo and *.bar. Shuffling it around, I found that > --include="*/" --include="/this_dir/***" --include="*.foo" > --include="*.bar" --exclude="*" > does what I want and it even makes sense. Those two commands should be equivalent. If you have a reproducible case in which they aren't, please share it and we can see if there's a bug. I tried the first command and it worked fine for me. That is, after I fixed a typo I made in the name of "this_dir", which left the --include="/this_dir/***" nonfunctional and gave a result like the one you cited above: [sender] hiding file this-dir/one because of pattern * -- Matt -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html |
|
|
Re: Yet another include/exclude questionMatt McCutchen wrote:
> On Tue, 2009-11-10 at 09:45 +0800, Thomas Gutzler wrote: >> Thanks everyone for your help, I've got what I want. >> >> My first attempt has been >> --include="*/" --include="*.foo" --include="*.bar" >> --include="/this_dir/***" --exclude="*" >> which did nothing than *.foo and *.bar. Shuffling it around, I found that >> --include="*/" --include="/this_dir/***" --include="*.foo" >> --include="*.bar" --exclude="*" >> does what I want and it even makes sense. > > Those two commands should be equivalent. If you have a reproducible > case in which they aren't, please share it and we can see if there's a > bug. Going through my history, I found that I must have accidentally put a whitespace between '--include' and '=' which wasn't very obvious at the time thanks to the line wrapping of my terminal. I should have used an include file instead :) So no, no bugs. Tom -- Please use reply-all for most replies to avoid omitting the mailing list. To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html |
| Free embeddable forum powered by Nabble | Forum Help |