ActiveTransfer Server 10.7 | webMethods ActiveTransfer Documentation | Administering ActiveTransfer Server | Welcome to webMethods ActiveTransfer (new user interface) | Managing Actions | Adding a Monitor folder Action
 
Adding a Monitor folder Action
You can define a monitor folder action to monitor a directory in the local file system or shared file system. You can further trigger the action based on the file operation you select.
*To add a monitor folder action
1. In the navigation pane, select Actions > Monitor folder.
2. On the Monitor folder actions page, you can do one of the following:
*If you want to create a new action, click .
*If you want to create a copy of an action that already exists, select an existing action, and click .
3. To define the conditions that trigger the action, specify the following details:
Field
Description
Action name
Type a unique name for the monitor folder action.
Description
Type a brief description for the monitor folder action.
Active
Click the toggle button to activate () or deactivate () the action.
Criteria
Click . In the Criteria dialog box, fill the following fields and click Ok:
*Monitor folder: Type or browse to the folder to monitor. When ActiveTransfer Server starts monitoring a folder, a lock file with format _{event_id}.mftlock gets automatically created. This is to ensure only a single instance of the monitor folder action can monitor the particular folder.
After the lock file is created successfully, ActiveTransfer Server will start monitoring the folder. However, if the lock gets deleted by an external entity, then ActiveTransfer Server will stop monitoring the folder.
*Select the file operation: Select the file operation that will trigger the action:
*Create file: If you choose this option, ActiveTransfer Server will trigger the monitor folder action on creating a file in the monitored folder.
In case of successful execution of the action, ActiveTransfer Server moves the newly created file to the Completion folder. If the execution fails, the newly created file are moved to the Error folder.
ActiveTransfer Server performs a stability check on a newly created file for 30 seconds. It triggers an action if there is no update on the file for last 30 seconds or the file is not in use by another process.
*Delete file: If you choose this option, ActiveTransfer Server will trigger the monitor folder action on deleting a file in the monitored folder.
Note: 
*If you specify an action based on the deletion of a file, make sure that any subsequent tasks you define for the action does not rely on the presence of the deleted file.
*TMP files created or deleted by the operating system in the monitored folder will not trigger monitor folder action.
*File filter: Type the name of the file if you want to filter files with specific names. By default, ActiveTransfer Server considers all the files. If you want to use regular expression, specify a valid regular expression in File filter and select Use regular expression option.
Note:
You can use wildcard characters to filter the file names. For example, type *.zip to trigger the action only when ZIP files are created or deleted. To trigger an action based on a name string in the ZIP files, use the name string in the File filter box, preceded and followed by wildcard characters. For example, type *invoice*.zip to trigger the action based on the file names, when ZIP files containing the character string invoice in their file names are created or deleted.
Few examples for regular expressions are:
*^(?!.*purchaseorder).*$: Excludes files with the file name containing purchaseorder.
*^abc(.*)123$: Includes anything that starts with abc and ends with 123. Matches abc123, abcxyz123, but not abcxyz123def.
*NEW-((*.doc)|(*_backup_*)): Includes anything starting with NEW- that either ends in .doc, or is followed by the string _backup_.
*Completion folder: Type or browse to the folder to move the file after the successful execution of an action.
*Error folder: Type or browse to the folder to move the file after an execution fails for the action.
*Watch frequency (sec): Specify the time interval in seconds to monitor the folder.
*Retention period (days): Specify the number of days you want to retain the files in Completion folder or Error folder.
Note: 
*If you want to retain the files permanently in Completion folder or Error folder, set the value for this field to 0.
*If the specified value for the retention period is greater than 0, and if the monitor folder action for those files is active, then the files gets deleted from the completion folder or error folder after the specified number of days.
*When ActiveTransfer Server starts monitoring the folder, it tries to process the existing files in the monitored folder. If the completion folder or error folder is missing, then ActiveTransfer Server does not process the existing files.
Tasks
Select one or more of the following tasks and define configurations for each of the tasks in the Properties section as required:
*File operations
For descriptions of the fields for these task configurations, see Task Configuration Definitions.
Tip:
Click to disable a task. Click to enable a task. Click to delete the task. By default, a task is enabled when created.
Import
Click to import a task from an existing post-processing action. You can import all the tasks from a particular post-processing action. However, ActiveTransfer Server enables you to import tasks only when the monitor folder action does not have any task defined for it. For information on post-processing action, refer Adding a Post-Processing Action.
4. Click Add.
The new monitor folder action appears in the monitor folder actions list.
Note:
If the auto-generated lock file from the monitor folder gets deleted, ActiveTransfer Server will not execute the action even if it is active. In such case, to restart the same action, you need to update the action.
Note:
We recommend that you use File name filters to avoid execution of monitor folder action for unexpected files.
Important:
While configuring the action, please note the behavior of each task mentioned below:
*Rename : If the existing file and the file to be renamed point to the same monitored folder, then the rename task can lead to an unexpected result.
*Zip: If the destination location point to the monitored folder, then the zip task can lead to an unexpected result.
*Unzip: If the destination location point to the monitored folder, then the unzip task can lead to an unexpected result.
*Encrypt: You must be careful while configuring the encrypt task for monitor folder action, as it can lead to creating temporary files while encrypting the files. These temporary files may trigger the action again. However, you can execute an encrypt task on the files that are created after performing the copy or move actions and not the original file.
*Decrypt: You must be careful while configuring the decrypt task for monitor folder action, as it can lead to creating temporary files while decrypting the files. These temporary files may trigger the action again. However, you can execute a decrypt task on the files that are created after performing the copy or move actions and not the original file.
Note:
If a folder is already being monitored, then you cannot monitor the same folder with any other monitor folder action that is active. However, if you want to execute any other monitor folder action on the same folder which is monitored, then you must deactivate the current action and reactivate the new action to take effect.