On Fri 06 Dec 2024 at 18:30:27 (-0500), pe...@easthope.ca wrote:
> Hypothetical shell usages (1) & (2).
> 
> (1)
> Restore() { \
>   source=somewhere/Backup/ ;
>   destination=elsewhere/workingDirectory ;
>   rsync \
>   --exclude '*.mp3' \
>   --exclude '*.mp4' \
>   -anuv $source $destination ; }

  If you want to modify exclusions, you have to edit the code.

> (2)
> exclusions='*.mp3'
> exclusions+='*.mp4'
> Restore() { \
>   source=somewhere/Backup/ ;
>   destination=elsewhere/workingDirectory ;
>   rsync \
>   -anuv --exclude=$exclusions $source $destination ; }

  I would put

    *.mp[34]

  in a separate config file.  I usually name those after the script to
  make them easier to find:

    #!/usr/bin/env bash
    export PATH=/usr/local/bin:/bin:/usr/bin
    tag=${0##*/}
    ...

    excfile="/usr/local/etc/${tag}-exclude"
    test -s "$excfile" || { echo die screaming; exit 1; }
    ...

    rsync -anuv --exclude-from="$excfile" "$source" "$destination"

-- 
Karl Vogel                      I don't speak for anyone but myself

COMMENT: That's an amazing deal, would snap it up if I had the money.
REPLY:   You can eat next month.    --Reddit on buying storage, 21 Nov 2024

Reply via email to