Creating a File Watcher Event
- Updated on 05 Mar 2019
- 2 minutes to read
A File Watcher event monitors a specified directory, then tells the system to perform an action when a file is added to that directory. The system can delete, move, or rename the file.
Use the Schedule Event dialog to create the event, and schedule the event to occur at any interval, including a custom interval set in the dialog's Advanced Calendar step.
In the example, create a File Watcher event using a dialog, set its interval using the advanced calendar, then see the event in action.
To begin, navigate to the folder System > Jobs and Events > Events and click the Add Event button.
In the Please Select Events step, select File Watcher Event and click Next .
In the File Information step, enter the directory path that the File Watcher event should monitor. In the What do you want to do with file drop-down list, you can choose Delete, Move or Rename, for this example select Rename .
A new field, Suffix , appears. Enter the suffix that should be appended to file names for any files added to the watched directory.
You could also choose to add a filter that only runs the event on files with names that contain a certain string.
Select Next .
In theEvent Info step, enter a name for the event in theName field.
By default, if the action fails, it is requeued. We could also choose to create a task if the job fails.
Select Next .
The next step allows you to choose how often the watched file event is run. To set a custom interval, we select the Advanced option.
In the Advanced Calendar step, select Time Span Schedule and click Next .
The TimeSpanSchedule step allows you to set precise intervals using seconds, minutes, hours, days, months, and years.
To enter a value, click and drag the slider, or enter the value in the field.
In this example set the interval for 2 minutes and click Finish .
To see the File Watcher Event in action. Navigate to the watched directory and create a text document in it.
After two minutes, the document is renamed with the suffix as we configured it in the Schedule Event dialog.