Using a RegEx filter in the Directory Monitor

The following example uses a Regular Expression filter in a directory monitor to only create events for files that contain the characters 'ops' in the filename.

Start by creating a new directory monitor and entering the values desired for the directory to be monitored along with a file mask and what is to happen to any discovered files that match the mask.

RegEx

The above example will look for any files in the c:/temp/files directory that match the mask *.txt.

Next, specify an optional expression in the RegEx Filter field to further filter the files that match the mask *.txt. In order to enter the expression, first click on the checkbox ‘Perform post-processing on file names returned.’

Clicking on the ellipsis (...) button in the RegEx field gives you a dialog in which you can test the RegEx Expression against any string you enter:

Using a RegEx filter in the Directory Monitor

Pressing the test button in the above example will display the result that the test string did match the expression entered. Any simple or complex Regular Expression can be used to further filter the names of the files that will cause an event to occur in EO. The simple example above will only return file names if they contain the characters opc.

After entering the Regular Expression and saving the directory monitor definition, EO will start monitoring the c:/temp/files directory for any files that match the mask *.txt and contain the characters opc.

Any events that occur for this monitor will be displayed in the Events list under System Reports in the Operations section:

Using a RegEx filter in the Directory Monitor

The event monitor can also now be placed in any process trigger to cause the process to run when an event occurs.