There are a couple of ways to choose which files to be ignored, and which files to be included in the backup.

Literal File Names
-The easiest pattern is a literal file name, for example:

whitelist.txt
This will ignore any files named whitelist.txt, which is a common file on Minecraft servers.

Directories
-You can ignore entire directories, just by including their paths and putting a / on the end:

node_modules/
logs/

If you leave the slash off of the end, it will match both files and directories with that name.

Wildcard
-The * matches 0 or more characters (except the /). So, for example, *.log matches any file ending with the .log extension.

Another example is *~, which matches any file ending with ~, such as index.cfg~

You can also use the ?, which matches any one character except for the /.

Negation
-You can use a prefix of ! to negate a file that would be ignored.

*.log
!example.log

In this example, example.log is not ignored, even though all other files ending with .log are ignored.

But be aware, you can't negate a file inside of an ignored directory:

logs/
!logs/example.log

Due to performance reasons, backup will still ignore logs/example.log here because the entire logs directory is ignored.

Double asterisk
-** can be used to match any number of directories.

**/logs matches all files or directories named logs (same as the pattern logs).

*/logs/.log matches all files ending with .log in a logs directory.

logs/*/.log matches all files ending with .log in the logs directory and any of its subdirectories.

Double asterisk can also be used to match all files inside of a directory, so for example logs/** matches all files inside of logs.

Was this answer helpful? 0 Users Found This Useful (0 Votes)