On 12/6/24 17:11, pe...@easthope.ca wrote:

These

>   rsync \
>   --exclude '*.mp3' \
>    --exclude '*.mp4' \

>   rsync \
>   --exclude=$exclusions

are not the same.  In the first one you have "--exclude" for each pattern,
and in the second you have it once.  I suspect the first one is correct, and
for that reason I vote for that one, even those typing "--exclude" several
times gives several opportunities for error.  You could do something
overengineered like defining an array "excludepatterns" for patterns, and
then doing something like

rsync  \
$(for pattern in ${excludepatterns[@]} ; do
  echo -- "--exclude  '$pattern'"
done)

Modulo mistakes, of course.  And make sure it deals with wildcards, quotes,
and spaces appropriately.

Reply via email to