-
Notifications
You must be signed in to change notification settings - Fork 38
Exclusions
Exclusions provide a way to ignore changes to specific files, or folders in a path being watched. To add exclusions to a watch, you would add the <exclusions>
child element, and then one or more exclusion-type elements within the <exclusions>
element. Exclusions can be file names, folder names, file or folder attributes and paths relative to the watch path.
Exclusions are processed before any other function for the watch is performed, so adding an exclusions will prevent notifications, actions, or commands from being run for change.
<watches>
<watch>
<exclusions>
<files>
<name></name>
</files>
<folders>
<name></name>
</folders>
<attributes>
<attribute></attribute>
</attributes>
<paths>
<path></path>
</paths>
<log></log>
</exclusions>
</watch>
</watches>
There are different types of exclusions that can be specified within the <exclusions>
element. These include the following:
Exclusion | Description |
---|---|
files |
File patterns for the filter. For more information, see Patterns. |
folders |
Folder patterns for the filter. For more information, see Patterns. |
attributes |
File or folder attributes to exclude. |
paths |
Paths relative to the watch path to exclude. |
log |
Set to false to disable logging of exclusions, or true to keep logging. Defaults to true . |
Each of the above exclusions represent a child element of the <exclusions>
element for a watch. All of the elements can contain a list of what to exclude, so for example, multiple files names can be specified under the <files>
element, or multiple attributes can be specified under the <attributes>
element.
Any number of exclusions can be used, so you can exclude based on both file names and attributes, or attributes and paths, or even specify exclusions for each outlined above. When specifying multiple exclusions, the change is checked against any of the exclusions, and if it matches the change is excluded. The change location doesn't have to match all specified exclusions, it only needs to match one.
The next few sections provide more detail on each of the exclusions.
The files exclusions uses the <files>
element and contains a list of file names specified with a <name>
child element. Any file names that match those specified here, regardless of their path, will be excluded from performing any function when changed.
Folders can be excluded by specifying each folder under the <folders>
element. Much like the files exclusions, the <name>
child element is used to specify the folder name. Any path that includes the folder name will be excluded, so a child folder will be excluded if a parent folder is in the folder exclusion list.
To exclude a file or folder based on its attributes, the <attributes>
element can be used. This element will contain a list of one or more <attribute>
child elements that specify an attribute to exclude.
The attribute values include the following:
Attribute | Description |
---|---|
Archive | The file or folder is marked as archive. |
Compressed | The file or folder is compressed. |
Encrypted | The file or folder is encrypted. |
Hidden | The file or folder is hidden. |
ReadOnly | The file or folder is read only. |
System | The file or folder is marked as system. |
Note: The above attributes are case-sensitive, so they will need to be added to the configuration file as shown above.
If a specific file or folder needs to be excluded, and the file or folder exclusion lists are too broad, you can specify a relative path to the file or folder using the <paths>
element. You can specify multiple <path>
child elements - one for each path - that you would to exclude.
By relative path, this means that the path must be specified with the path of the watch removed from the beginning. For example, if the watch path is C:\Temp
and you would like to exclude the folder C:\Temp\Docs\Recipe
, you would specify the path as Docs\Recipe
in the <path>
child element. The same would apply to a specific file.
If a file or folder change was excluded for a specified reason, the exclusion will be logged into the log file. If you are unsure why no function was performed on a change, check the log file to determine if the change was excluded.
For more information, see Logging.
Exclude a file named doc1.doc
:
<watches>
<watch>
<path>C:\Temp</path>
<exclusions>
<files>
<name>doc1.doc</name>
</files>
</exclusions>
<watch>
</watches>
Exclude a folder named Documents
:
<watches>
<watch>
<path>C:\Temp</path>
<exclusions>
<folders>
<name>Documents</name>
</folders>
</exclusions>
<watch>
</watches>
Exclude a file or folder with the System attribute:
<watches>
<watch>
<path>C:\Temp</path>
<exclusions>
<attributes>
<attribute>System</attribute>
</attributes>
</exclusions>
<watch>
</watches>
Exclude the file C:\Temp\Documents\doc1.doc
:
<watches>
<watch>
<path>C:\Temp</path>
<exclusions>
<paths>
<path>Documents\doc1.doc</path>
</paths>
</exclusions>
<watch>
</watches>
Exclude files named doc1.doc
or folders named Documents
:
<watches>
<watch>
<path>C:\Temp</path>
<exclusions>
<files>
<name>doc1.doc</name>
</files>
<folders>
<name>Documents</name>
</folders>
</exclusions>
<watch>
</watches>