feature request: exclude from path

Paul Slootman paul+rsync at wurtel.net
Mon Aug 3 14:28:40 UTC 2020


On Mon 03 Aug 2020, Matt Stevens via rsync wrote:

> So I've gotten excluding paths to work as a standalone command. When I paste
> this into a script however, it ignores the exclusions. Any advice?
> 
> rsync -aXvr --times --links
> --exclude={'*.vdi','*.vmdk','*.ova','*.qcow2','.config/discord/'}
> /home/path/ user at nas:/NAS/HOME/destination/
> 
> Are there supposed to be some kind of brackets around this?

Using these brackets with bash causes the --exclude to be repeated for
each value:

$ echo TEST: --exclude={'*.vdi','*.vmdk','*.ova','*.qcow2','.config/discord/'}
TEST: --exclude=*.vdi --exclude=*.vmdk --exclude=*.ova --exclude=*.qcow2 --exclude=.config/discord/

I suspect you've pasted this into a shell script which does not start
with #!/bin/bash but perhaps #!/bin/sh so that the script is not run by
bash but e.g. ash or dash that don't do the braces expansion.

It's always best (especially in a script) to write it out, don't rely on
the shell for such things.


Paul



More information about the rsync mailing list