[colug-432] rsync include/exclude

Richard Hornsby richardjhornsby at gmail.com
Wed Mar 4 21:04:32 EST 2015


> On Mar 4, 2015, at 10:50, Rick Hornsby <richardjhornsby at gmail.com> wrote:
> 
> 
> 
>> On Mar 4, 2015, at 10:28, Jeff Frontz <jeff.frontz at gmail.com> wrote:
>> 
>> Sounds like your "pat[1-N]" aren't specific enough --  please provide
>> the exact command, list of files on the source, output from rsync, and
>> indications of what files you didn't want.
> 
> I have to type this out on my phone by hand since my work computer has limited interwebs access.
> 
> After studying the rsync debug output a little more while trying to retype it here, I saw the error was that rsync was taking an include pattern with literal quotes wrapped around it.
> 
> I'll try to type up a better explanation when I have a real keyboard.
> 
> It was another escape gotcha that happens when you're working in a shell script vs directly on a shell prompt.


So, essentially, the problem was that inside of a shell script I was building the —include= rsync arguments for later use.  I was wrapping the right side in quotes, like so

	—include=“*.log-2015-*"

rsync was using these quotes literally.  I noticed it in the debug output near the top of the rsync run when it was processing the filters.

The quotes work fine when you’re running on the command line - and is often necessary to prevent bash from doing weird things.  However, in this case they were not only unnecessary, but causing the aforementioned undesired behavior.

It wasn’t until I was starting to type it at Jeff’s request that I saw the problem.  Thanks, Jeff!

-rj


More information about the colug-432 mailing list