Knowledgebase: Tips and tricks
Using filter expressions
Posted by Sven Koester, Last modified by Andre Kuehnemund on 29 March 2021 15:53
Filters are very powerful helpers when creating archives or backups. Filters are refered to by their name in Archive, Backup and/or Synchronize Plans.|
Include filters define files and directories which should be included in the selection. Without definition, all files are included.
Exclude filters define files to be skipped from the selection. Without definition, no files are excluded.
When combining the two filters, include filters are processed first, followed by exclude filters.
PLEASE NOTE: When using filters with P5 Synchronize, filters are being applied to both the source AND the target.
Filters of type file
File filters are applied on file names. A type file filter with the expression ends with .bak will match all files with the extension .bak, regardles where and how many files are matched.
Filters of type directory
Directory filters are applied on directory names. They are very similar to filenames with one exception: PresSTORE assumes that all files below the matched directory are matched as well. Note that in case a size is passed as filter expression for directories, it is applied on the file holding the directory contents; this is usually not what you really wanted. The size does not reflect the size of the contained files in the directory.
Filters of type path
This is the most powerful filter variant. The expression is applied to the full path of the destination. Note that this is not a wildcard expression, as used to identify multiple files, but instead a lexicographical comparison applied on the full path.
A path type filter with the expression ends with .bak will match all files with the extension .bak. It will not match diretories ending with .bak, because files in that directories that do not end with .bak will not match. Thus, in order to find special directories or subtrees, specify that the path contains an expression.
Filters can be created in expert mode, too. The expert mode allows you to add options as understood by the command find to the filter. For expert options please refer to the man page of the command find, e.g. on the web at https://linux.die.net/man/1/find