Advanced Topic: Setting Custom Exclusions via XML Advanced Topic: Setting Custom Exclusions via XML

Advanced Topic: Setting Custom Exclusions via XML

Casey Casey
This article applies to Backblaze client versions listed and those version above:
Windows: 4.1.0.951
Mac: 4.1.0.952
 
Exclusions
Exclusions have been in Backblaze from the release of the software.
However, there has been some changes to make it easier for people to see what exactly is excluded and, as of version 4.1, to set custom exclusions other than the standard folder, file size, or file type options. 
 
In the new system there are some exclusions that are mandatory and these exclusions are OS files and program files.  These exclusions are in the file named 
bzexcluderules_mandatory.xml.  
 
This file is located here on a PC:
C:\Programdata\Backblaze\bzdata
 
and here on the Mac:
/Library/Backblaze.bzpkg/bzdata
 
The bzexcluderules_mandatory.xml files CAN NOT be edited, any edit done to this file will be ignored.
 
This file can be view with a text editor.  Please, make the window large to view the file properly. This will contain the permanent exclusion that Backblaze uses.
 
Exclusion Creation
If you wish to create your own rules for exclusions, you can now create more robust rules to exclude data.
This is can be done by editing the file bzexcluderules_editable.xml.
 
Please note: Support will not troubleshoot any edits in this file, or create rules.
If support is contacted, in a matter regarding the edit of the bzexcluderules_editable.xml file, you will be instructed to delete the file, then click to backup and the default file will be generated once more.
 
 There will be a method in the future to put in rules through the GUI and this will be supported.
 
In the meantime if you wish to try creating  rules the information to set up the rules are below.
 
 
Information about the bzexcluderules_editable.xml file.
 
Editable Exclusions: You may edit this file. 
WARNING: ONLY FOR ADVANCED USERS! 
To restore the defaults, remove this file (it will return).
 
Rules on how to create exclusion rules                                                                             
Rule 1: All the excludefname_rule below are case insensitive.                   
                                                                                 
Rule 2: a file must match ALL criteria on the line to be excluded from backup.  
                                                                              
Rule 3: An excludefname_rule must specify all criteria. Use "*" to skip criteria.
                                                                               
Rule 4: "skipFirstCharThenStartsWith" - is "*" or must be at least 4 chars long.
                                                                                 
Rule 5: All rules apply to all attached volumes. 
 
On Windows this means all rules are applied to C:\, D:\, E:\, etc. 
 
On Mac, this means "/" and also /Volumes/externalUsbDrive/ and /Volumes/movies/, etc.             
 
List of valid osVers for Windows: Vista, Seven, Eight, Ten                 
 
List of valid osVers for Mac: 10.7, 10.8, 10.9, 10.10, 10.11, 10.12, 10.13, 10.14, 10.15
 
"hasFileExtension" vs "endsWith" - a "file extension" in our context is strictly defined as the last period followed by non-space simple ASCII characters and does not contain forward slash (/) or back slash (\).  The "endsWith" is more general, like it can have spaces and include either slash.  The "hasFileExtension" is faster and helps the code group together same file extensions so you should always specify the hasFileExtension if possible.      
                                                                                
Performance hints
Always specify a "skipFirstCharThenStartsWith" if possible, it is very fast and help prune 99% of files from undergoing any more criteria checks.  
 
Internally, the code groups together many tests that have identical startsWith and skipFirstCharThenStartsWith so those comparisons are only done once (not once for each excludefname_rule). 
 
Next is specify an "hasFileExtension"  if possible, or if not then define "endsWith" which are faster performance than the "contains_1" and "contains_2".   
 
On Win7 system, C:\Users\ lines account for 10 percent of the lines in "per volume filelists" so that is a great prune to get rid of 90% of the rest of the criteria.               
 
 
Sample file contents below for Windows Exclusions:   
                                                                                
<?xml version="1.0" encoding="UTF-8" ?> 
 
<bzexclusions>
 
 Below here is for Microsoft Windows systems (XP, Vista, 7, 8, 10)             
 
 In the block below, are the optional Windows excludes the customer is allowed to edit   
 
<-- This block is for Internet Explorer history and cache files -->
<excludefname_rule plat="win" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith=":\Users\" contains_1="*" contains_2="*" doesNotContain="*" endsWith="\microsoft\windows\webcache\webcachev01.dat" hasFileExtension="dat" />
 
<excludefname_rule plat="win" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith=":\Users\" contains_1="*" contains_2="*" doesNotContain="*" endsWith="\cookies\index.dat" hasFileExtension="dat" />
 
<excludefname_rule plat="win" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith=":\Users\" contains_1="*" contains_2="*" doesNotContain="*" endsWith="\recent\index.dat" hasFileExtension="dat" />
....   more rules here ....