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@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 -- 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