-
Notifications
You must be signed in to change notification settings - Fork 34
Actions
Actions allow a basic IO operation to be performed when a file or folder change is detected. There are three actions that can be performed: Copy
, Move
, and Delete
. These three operations can be performed on any specified source or destination location. All actions for a watch are listed within the <actions>
element within the <watch>
element.
Since a watch can perform multiple actions, the <actions>
element can include one or more <action>
child elements that specify the details of the action.
<watches>
<watch>
<actions>
<variables></variables>
<action>
<triggers></triggers>
<variables></variables>
<type></type>
<source></source>
<destination></destination>
<verify></verify>
<keepTimestamps></keepTimestamps>
<waitbefore></waitbefore>
</action>
</actions>
</watch>
</watches>
A <actions>
element can contain the following child elements:
Element | Description |
---|---|
variables |
(Optional) (Version 2.x or higher.) The variables for all child steps. For more information, see Variables. |
action |
An action to perform. |
To perform an action, the following information can be specified:
Element | Description |
---|---|
triggers |
The triggers for the notification. For more information, see Triggers. |
type |
The type of action to perform. |
source |
The source file location. Can include Placeholders. |
destination |
The destination file location. Can include Placeholders. Not used by the Delete action. |
verify |
(Optional) Flag that indicates whether files are to be verified using a hash for the Copy or Move action. Default: false. |
keepTimestamps |
(Optional) Indicates that the destination creation and modified timestamps should be kept the same as the source. Only applies to the Copy and Move actions. |
waitbefore |
(Optional) Number of milliseconds to wait before performing the action. |
variables |
(Optional) (Version 2.x or higher.) The variables for all child steps. For more information, see Variables. |
Information about the valid triggers, can be found on the Triggers page.
The <type>
element specifies type of action to be performed. The valid values are:
Type |
---|
Copy |
Move |
Delete |
The source path is specified with the <source>
element. This value is used by the Copy
, Move
, and Delete
. For the Delete
action, the path specified here will be deleted. The path value specified can use Placeholders to provide dynamic path content.
The destination path is specified with the <destination>
element. This value is used by the Copy
and Move
, and this value is ignored when performing the Delete
action. The path value specified can use Placeholders to provide dynamic path content.
The <verify>
element indicates that when a Copy
or Move
action is to be performed, the source and destination file hashes are generated and compared to ensure both files are identical.
This is a boolean value, and the valid values are true
and false
.
The default value for the <verify>
element is false
.
The <keepTimestamps>
element indicates that when a Copy
or Move
action is performed, the creation and modified timestamps of the source file will be kept for the destination file.
This is a boolean value, and the valid values are true
and false
.
The default value for the <keepTimestamps>
element is false
.
Move created files in the C:\Temp2
folder to C:\Temp
. If the file created is C:\Temp2\Documents\test.doc
, then the source path ([exactpath]
) will resolve to C:\Temp2\Documents\test.doc
, and the destination path (C:\Temp\[fullpath]
) will resolve to C:\Temp\Documents\test.doc
.
<watches>
<watch>
<path>C:\Temp2</path>
<actions>
<action>
<triggers>
<trigger>Create</trigger>
</triggers>
<type>Move</type>
<source>[exactpath]</source>
<destination>C:\Temp\[fullpath]</destination>
<verify>true</verify>
</action>
</actions>
</watch>
</watches>
Delete a matching file in C:\Temp
when one is created in C:\Temp2
. If the file created is C:\Temp2\Documents\test.doc
, then the source path (C:\Temp\[fullpath]
) will resolve to C:\Temp\Documents\test.doc
, which will be deleted.
<watches>
<watch>
<path>C:\Temp2</path>
<actions>
<action>
<triggers>
<trigger>Create</trigger>
</triggers>
<type>Delete</type>
<source>C:\Temp\[fullpath]</source>
<verify>true</verify>
</action>
</actions>
</watch>
</watches>