Tips for creating custom backup policy rules
Here are a few tips to remember when creating custom rules in backup policies:
-
Case sensitivity. All fields are case insensitive.
For example, if you specify the file name
report
, the rule matches files with the namereport
orReport
. -
Wildcard characters. To match partial names of folders, files, or extensions, use wildcard characters. See how.
-
To match a single character in an item's name, enter a question mark (
?
).For example:
-
report-??
matchesReport-AB
but notreport-A
-
do?
matchesdot
ordoc
but notdocx
-
-
To match zero or more characters in a name, enter an asterisk (
*
).For example:
-
report*
matchesReport
andReport1
;*report
matchesMyReport
-
doc*
matchesdoc
anddocx
-
-
To match any one folder level in a folder path, enter a percent sign (
%
).For example, for a Windows-based computer:
-
*\reports\%\year\
matchesC:\reports\sales\year\
andC:\reports\trip\year\
-
*\reports\%\year\
does not matchC:\reports\Year2014\trip\year\
-
NOTE: The asterisk wildcard character in any field makes the rule recursive.
-
-
Default field value. The default value for each field is the asterisk wildcard character (
*
).If you do not specify a field's value, the application automatically sets it to an asterisk when you save the rule. Fields that contain the default value match all items for that field. See details.A default value in the following fields cause the rule to behave as specified:
-
Folder. The rule matches all folders the policy does not skip due to scope options.
-
File. The rule matches files of any name.
-
Extension. The rule matches files of any extension, including files without extensions.
NOTE: The default value in any field makes the rule recursive.
-
-
Folder recursion. Rules are recursive if any of its fields contain the specified values:
-
Folder path. Default value (no value or an asterisk) or a path that ends with an asterisk (*), such as
C:\Reports\*
. -
File name. Default value.
-
File extensions. Default value or more than one extension.
You can define rules to target all folders, a folder and its subfolders, or a single folder. See how.-
Items in all folders. To target all folders not skipped due to scope options, specify the folder path as an asterisk
*
. Specify the file name and extensions as necessary.For example, target all files with a
txt
ordocx
extension in any folder not skipped by scope options:-
Folder path:
*
-
File name:
*
-
File extensions:
txt
,docx
-
-
All items in a folder and its subfolders. Specify only a folder path.
For example, target all files located in the user's
Documents
folder and its subfolders:-
Folder path:
$(USERPROFILE)\Documents\
-
File name:
*
-
File extensions:
*
-
-
Items in a folder and its subfolders. Specify a folder path and specify one or more file names, extensions, or both.
For example, target any file with the name
report
located in the user'sDocuments
folder and its subfolders:-
Folder path:
$(USERPROFILE)\Documents\
-
File name:
report
-
File extensions:
*
For another example, target the files
report.txt
andreport.doc
located in the user'sDocuments
folder and its subfolders:-
Folder path:
$(USERPROFILE)\Documents\
-
File name:
report
-
File extensions:
txt
,doc
-
-
Specific item in a folder and its subfolders. Specify a folder path appended with an asterisk (
*
), a file name, and an extension.For example, target the file
report.txt
located in the user'sDocuments
folder and its subfolders:-
Folder path:
$(USERPROFILE)\Documents\*
-
File name:
report
-
File extensions:
txt
-
-
Specific item in a single folder. Specify a folder path, a file name, and extension.
For example, target the file
report.txt
located in only the user'sDocuments
folder:-
Folder path:
$(USERPROFILE)\Documents\
-
File name
report
-
File extensions:
txt
-
-
-
Environment variables. An environment variable is a dynamic object that contains information about the currently logged on user's operating environment, such as their user name or home folder. You can use an environment variable to specify a file or folder.
When an Agent evaluates the rule, it uses the value of the variable on the local system. Agents can access system and user environment variables. See how to use environment variables.To specify a file or folder using an environment variable
-
For either the folder path or file name value, depending on the variable's value, specify the following:
$(variable)
For example, if you use the
windir
environment variable on Windows-based computers, specify the folder pathC:\Windows\reports
as:$(windir)\reports
A common way to specify the user's home folder using an environment variable is as follows:
-
Windows:
$(USERPROFILE)\
-
macOS:
/Volumes/${ROOT}$(HOME)/
-
-
Registry keys. You can use a Windows registry key to specify the file or folder. (Windows only)
If a rule contains a registry key that the Agent cannot access, the Agent ignores the rule. See how to use a registry key.When using a registry key, keep the following in mind:
-
You can use the key HKLM in place of HKEY_LOCAL_MACHINE.
-
HKEY_CURRENT_USER represents the user currently logged on to the computer at the time the Agent reads the key.
-
Paths in Windows registry keys that use short names (for example,
PROGRAM~1
instead ofProgram Files
) will not work.
To specify a file or folder using a registry key
-
Do one of the following:
-
If the key contains a folder, specify the folder path as
$[key]
. -
If the key contains a file name, specify the file name as
$[@key
].The rule will disregard any characters following the final backslash (
\
).
-
For example, target all TXT files located in the folder (including subfolders) specified by the key's value:
-
Folder path:
$[HKEY_CURRENT_USER\SOFTWARE\MyApp\2.20\InstallPath]
\ -
File name:
*
-
File extensions:
txt
NOTE: Agents read the Windows registry key when the Agent Service starts, such as when a user restarts the computer. Therefore, if you publish a policy containing a rule that uses a registry key, the Agent ignores it until the Agent Service restarts.
-
-
Complex field values. You can combine wildcard characters, registry keys, and environment variables in a single field.