Exclude rules syntax

You can define exclusion rules to exclude specified drives, directories, or files from backup jobs. After you define the rule, the specified items are not backed up as part of your SLA policy or as part of an ad hoc backup job. When you run a restore job, the drives, directories, or files that are specified in the exclude rules are not restored to the new copy.

Exclude rules can be defined for the entire Windows file systems application. Rules that define the excluded resources are inherited by each file system that is being protected. To define new rules for a particular file system instance, you can add a rule in the File systems window. Select the file system servers that you want to add the rules for. The new rules that you define for that file system backup job override the exclude rules that are set for Windows file systems.

For more information about defining a backup job, see Backing up file system data.

To exclude a file, specify a rule as shown in the following example: Z:\test\excludedFile.txt.

To exclude all files in a folder, specify a rule as shown in the following example: Z:\test\*.

To exclude a folder and its files, specify a rule as shown in the following example: DIR Z:\excludedFolder.

If you use global variables for certain directories, you can use those variables to exclude items regardless of their location. For example, if you wanted to exclude a directory that is called Blues owned by the registered user, you can specify DIR %USERPROFILE%\Blues. For more information about using global variables to exclude resources, see Table 2.

Table 1. Exclude rules syntax for Windows
Syntax Syntax behavior
:\
  • Indicates a file system and Windows drive.
  • Must be included in all rules except for the FS rule.
  • A rule cannot start or end with this syntax.
  • A rule must start with a drive letter or wildcard followed by this sequence.
\
  • Indicates the next directory level.
  • A rule cannot end with a backslash (\) character.
\...\
  • Indicates that the rule applies to all directories below this level.
  • A rule cannot start or end with a \...\ sequence.
  • This sequence must be after the drive specification sequence.
*
  • This syntax is the wildcard for any character or number of characters. It is also used when no character is defined.
  • A rule can start or end with this syntax.
  • When used to indicate a drive letter, this syntax must represent one alphabetic character.
  • This wildcard cannot be a backslash (\) character.
?
  • This syntax is used as a wildcard for any character for one occurrence only.
  • A rule can start and end with this syntax.
  • When this syntax is used to indicate a drive letter, it must be an alphabetic character between A and Z.
DIR
  • This syntax indicates a directory rule, but it does not exclude any files in the affected directory.
  • This syntax must be a heading rule followed by a blank.
FS
  • Indicates that a full file system drive is excluded from the job.
  • This syntax must be followed by a drive letter that can be a single character or a wildcard.
Spaces
  • Spaces are allowed in file names or directory names.
  • A blank is not allowed before a backslash, \, or in a heading or trailing in a rule row.
  • Spaces are validated as single characters.
Uppercase and lowercase text Microsoft Windows is case-sensitive. Exclude rules ignore case.
Table 2. Exclude rules that use global variables
Syntax Syntax behavior
DIR %PROGRAMDATA%
  • Indicates directory in the Windows ProgramData directory for the registered user.
  • This rule must be followed by a directory name, or wildcard to identify the resource to be excluded. For example, you can specify the following rule: DIR %PROGRAMDATA%\WinZip excludes the WinZip directory and all its content.
DIR %USERPROFILE%
  • Indicates directory in the Windows userprofile directory for the registered user.
  • This rule must be followed by a directory name, or wildcard to identify the resource to be excluded. For example, you can specify the following rule: DIR %USERPROFILE%\Elvis. This rule excludes the Elvis directory in that user's directory structure.
DIR %PROGRAMFILES%
  • Indicates a directory in the Windows Program Files directory for the registered user.
  • This rule must be followed by a directory name, or wildcard to identify the resource to be excluded. For example, you can specify the following rule: DIR %PROGRAMFILES%\* to exclude all directories from the program files directory structure for the registered user.
DIR %WINDIR%
  • Indicates any specified Windows directory for the registered user.
  • This rule must be followed by a directory name, or wildcard to identify the resource to be excluded.
  • An example is, DIR %WINDIR%\README. This rule excludes the README directory and all its content for the registered user.
Table 3. Valid exclude statements
Rule example Result
*:\* This rule excludes all files from the file system root directory from all drives, but does not exclude the directories.
DIR *:\* This rule excludes all directories from all drives, but does not exclude the files in the root directory.
DIR E:\...\*temp* This rule excludes all directories that start with temp in the directory name in all directories of the E: drive.
DIR F:\Users\Bobby\* This rule excludes all content from the Bobby directory without excluding that directory itself. Files in the Bobby directory are excluded.
DIR F:\Users This rule excludes all users who are listed in the Users directories and also excludes the Users directory.
DIR F:\Users\Bobby M?gee This rule excludes all directories that match the name with a wildcard for one letter. This rule excludes users with names like Magee, Megee, Migee, and so on.
DIR F:\Users\Bobby Magee This rule excludes the directory for the user who is defined, in this case Bobby Magee. With this rule, the directory for that user and all its content, including files and subfolders, are excluded.
F:\...\* This rule excludes all files from the F:\ drive, but it does not exclude the directories.
F:\Bobby.mp? This rule excludes all files that match Bobby.mp? in the file system root directory, such as Bobby.MP3, Bobby.MP4, and so on.
F:\Bobby.txt This rule excludes the file Bobby.txt in the file system root directory.
F:\Users\...\*.mp3 This rule excludes all MP3 files for all users that are listed in the F drive.
F:\Users\Bobby\...\*.mp3 This rule excludes all MP3 files from the user directory Bobby.
F:\Users\Bobby\...\*music*\...\*.mp? This rule excludes all MP files in all directories that have the word music in the directory name for user Bobby. The excluded files are MP2, MP3, MP4, and so on.

F:\Users\John\*

DIR F:\Users\John\*

This rule combination excludes all files and all subdirectories for the user John, but does not exclude the John directory itself.
F:\Users\John\tax\Tax_20??.pdf This rule excludes all documents that match the pattern Tax_20 in the John\tax directory. Files that are named like these are excluded, TAX_2000.pdf, TAX_2019.pdf, and so on.

FS F

This rule excludes the file system F drive.
FS * This rule excludes all drives in the file system.
FS ? This rule excludes all drives.

Invalid exclude syntax

The following syntax is invalid for exclude rules:
  • \no
  • *
  • \*
  • F:\no\
  • DIR \no
  • DIR F:\no\
  • DIR *
  • DIR F:\*\
Tip:

To verify the results of an exclude rule, view the job log file. In the navigation pane, click Jobs and Operations and open the Running Jobs tab. In the Application Server Backup section, find the newest log entry.