I want to be able to exclude some subfolders when compressing a folder during a rutine backup, and I did manage to do it, with something like this.
file=whatever
time='+%y-%m-%d'
folder=whatevertoo
zip -r ${file}$(date ${time}).zip ${folder} -x '*/ignoredir/*'
This works wonders, but I need the ignoredir to be passed as an argument or defined by a variable, and then is when I can't find a solution.
This does not work. The " ' " destroys the purpose of the " $ " to invoke a variable.
exclude=ignoredir
zip -r ${file}$(date ${time}).zip ${folder} -x '*/${exclude}/*'
Tried diferent combinations but nothing worked so far as for now.