All Collections
Our Command-line Tool
Using the command-line tool
Ignoring files and folders from backup with Jottacloud CLI
Ignoring files and folders from backup with Jottacloud CLI

Learn how to ignore files and folders with Jottacloud CLI

Updated over a week ago

Note: In version 0.12.50392 ignores changed to a new format. For details on how to patch from the old version to the new, see the section "Patching from v1 ignores to v2" at the bottom.

Using ignores, files and folders can be selectively ignored from your backup folders using the following commands:

jotta-cli ignores add --pattern PATTERN --backup BACKUP
jotta-cli ignores add --pattern PATTERN (adds the pattern to all backups)

where PATTERN can be either a file/folder path relative to the backup root,

or a glob-like pattern. The --backup flag can be omitted in order to add a pattern to all backup folders.

Adding a pattern

All patterns are defined relative to the root of your backup folder.

E.g. In a backup with an absolute path of /shared/Documents/backup1:

If you want to ignore a folder with the absolute path /shared/Documents/backup1/folder/subfolder, you would use the pattern folder/subfolder (and not /shared/Documents/backup1/folder/subfolder).

This would be done via the command:

jotta-cli ignores add --pattern folder/subfolder --backup backup1

Any leading / in a pattern will be ignored. It is implied as all patterns start relative to the backup root. Any leading or trailing whitespaces are also ignored. Trailing slashes will also be ignored: there is no distinction between files and folders in the new ignore system.

Removing a pattern

Patterns can be removed with the rem command:

jotta-cli ignores rem --pattern PATTERN --backup BACKUP

Glob patterns

You can use * or ** to make more dynamic patterns

* matches everything but /
** matches everything
**/ matches zero or more directories

Examples:

  • **.png matches every .png in the tree

  • *.png matches every .png in the root folder

  • foo/*.png matches every .png in the "foo" folder in the root folder

  • foo/**.png matches every .png in any folder below the "foo" folder in the root folder

  • **/foo/**.png matches every .png in any folder below any folder called "foo"

  • **/.ignoreme matches every file called ".ignoreme" in the entire folder tree

Testing glob patterns

Be aware of the shell expanding * or ** when inputting patterns. Use the below command to test that patterns work and are input correctly before adding them. You can test if a pattern will match a given path using

jotta-cli ignores test --pattern PATTERN --path PATH

Use variables or quotes to escape the pattern if you see the patterns being mangled.

On windows using msys2 you can set MSYS2_ARG_CONV_EXCL=* to prevent invalid expansion ( read more here: https://www.msys2.org/wiki/Porting/#filesystem-namespaces )

Some hardcoded patterns exist and cannot be removed.

These include:

**.DS_Store
**/.Thumbs.db
**/.desktop.ini

Amongst others.

Checking existing patterns

Existing patterns can be checked on a backup with the list command.

jotta-cli ignores list --backup BACKUP

If the --backup option is omitted, all patterns for all backups will be listed.

Patching from v1 ignores to v2

It is possible to ask the client to attempt to patch from the old ignore system to the new one if you haven't done it manually already. To do this, run jotta-cli ignores patch [--backup BACKUP], where specifying a backup is optional.

Note that some rules in the old ignores system are not supported in the new one. If any of these rules are encountered the ignore patching will abort and you must do it manually.

Did this answer your question?