How to use pattern to exclude folders and files in Backblaze

How to use pattern to exclude folders and files in Backblaze

The old saying says: "There are two types of people: those who do backups, and those who will do backups". I'm in the first group, and I already had a couple of backup strategies. But I took advantage of Black Friday promotions and added another one by purchasing the Backblaze subscription.
Backblaze is a pretty compelling offsite backup solution as it backups your entire computer without any storage limits. All you have to do is to install the client, and you can forget about everything. Yet, as convenient as it sounds, they might be situations when you don't want to backup specific folders or files. For example, backing up development folders like node_modules or .git doesn't make any sense.
If you want to ignore a specific folder or a file type, you can do this via UI client. But it doesn't allow you to add patterns, and manually adding every  node_modules folder is a waste of time.

Fortunately, there is another way to specify folders or files to ignore using patterns:

1. Open the Terminal, and open the Backblaze rules file using the following command

open /Library/Backblaze.bzpkg/bzdata/bzexcluderules_editable.xml

2. Then add your exclusions at the end of the bzexclusions tag:

<bzexclusions>
    <!-- Default exlusions omitted for brevity -->
    
    

    <!-- Exclude node_modules folders -->
    <excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />

    <!-- Exclude .git folders -->
    <excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />

    <!-- Exclude Swift .build folders -->
    <excludefname_rule plat="mac" osVers="*" ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.build/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
</bzexclusions>

Can you see the pattern? No pun intended 😝 Now, all you have to do is save the changes, and Backblaze will ignore the specified folders and files.

If you are interested, You can find more information about Backblaze custom exclusions in the documentation.


Comments

Anything interesting to share? Write a comment.