How to limit drush tar-options="–exclude pattern matching to be specific and not recursive

28/06/2018


With the folder structure like so
/site_root
/site_root/images
/site_root/core
/site_root/core/modules/images
/site_root/libraries
etc

When doing a drush archive dump backup, from the inside site_root (usually it’s public_html but in this case it’s another folder), I use
$ drush ard tar-options=”–exclude=images” –destination=~/.backups/[date].tar.gz

That way the archive dump skips the /site_root/images folder and the ard is much smaller.
Unfortunately for me pattern matching then causes all images folders throughout to be excluded due to recursivity.
So I would lose
/site_root/images
/site_root/core/modules/images
etc

I know in linux you can make tar-options look at the folder structure by making the pattern relative, like so
$ drush ard tar-options=”–exclude=./images”
But that is not working for me via drush ard tar-options.

I also tried the home folder shortcut ‘~’ (which works a treat on drush ard destination) like so
$ drush ard tar-options=”–exclude=~/site_root/images” –destination=~/.backups/[date].tar.gz
But, for some reason, that does not work like it does on the –-destination switch.

What is the best way to limit the drush tar-options=”exclude switch to either no-recursive or pattern match looking at relative path to working directory?

قالب وردپرس