vzdump exclude-path pattern match or anchored to start?

robm

Member
Jan 9, 2020
19
1
8
52
When using exclude-path in /etc/vzdump.conf, does an entry such as:
"/tmp/?*"
only match /tmp/abc, or would it also match /home/xyz/tmp/abc?

If we want to match directories like "/home/abc/www/var/report" and "/home/def/www/var/report" would this be the right syntax:
"?*/var/report/?*"

Thanks for any pointers on the various ways to match full directory paths, and then multiple relative ones.
 
If the pattern starts with a / then it is anchored to a particular spot in the hierarchy of files, otherwise it is matched against the end of the pathname.

See the "Include/Exclude Pattern Rules" section from https://linux.die.net/man/1/rsync for details about the pattern rules.

If we want to match directories like "/home/abc/www/var/report" and "/home/def/www/var/report" would this be the right syntax:
"?*/var/report/?*"

actually the following pattern should be enough: **/var/report/ This makes use of two rules:
* use ’**’ to match anything, including slashes.
* if the pattern ends with a / then it will only match a directory, not a regular file, symlink, or device

You do not need the glob afterwards, as specifying the directory will exclude all childs automatically, i.e., excludes are greedy.
The one in front was wrong, ** can be used to match any path (including slashes), ?* won't do that.