Using bzCLI to exclude directories from Backblaze
Create a JSON file with the bzdirfilter_add setting, then pass that to bzcli.
This is useful if you want to programmatically define exclusions, and seems better supported than my previous approach of manually editing Backblaze’s XML config files. There are two steps:
Create a JSON file with a path to the directory you want to exclude, like:
// exclude.json { "settings": { "bzdirfilter_add": [ { "dir": "/Users/alexwlchan/directory/to/exclude/", "whichfiles": "none" } ] } }Run the
bzclicommand:$ bzcli configure -j exclude.jsonThe excluded directory should appear in the list of exclusions in the GUI.
The bzcli command is bundled in the Backblaze app; see Backblaze’s documentation for details. It was introduced in February, so you may need to update the app to get it.
I looked for this command after finding that Backblaze was spending a lot of time backing up my Python virtual environments, which are ephemeral and not worth saving. I could easily recreate them on demand if necessary, and I’d never think to restore them from backup. (See also: the target directory in Rust, or node_modules in JavaScript.)
I have a fish function that I use to create virtual environments, and I’ve updated it to automatically exclude them from Backblaze backups.