Local File Watcher Action Plugin



This action plugin creates triggers based on the presence in a specified folder of files matching a specified pattern.

Saved Parameters Description

Details:

Inputs Description

The list of inputs depends on the configuration of the LocalFileWatcher action template.

Changes in this list of inputs will override any values set in the action template.

Outputs Description

Supported Actions

None

Dependencies

None

Operating Instructions

Overview: This action detects new files matching a certain pattern files matching a certain pattern and located below a directory visible locally. Both the pattern matching and the directory path must be provided by the user. The directory may be searched a single time as part of a work flow or can be treated similarly to a hot folder where it is continually scanned at set time intervals looking for a pre-defined trigger file. Once a trigger file has been detected it may either be parsed to obtain its contents, or have the names in the case of multiple triggers, be collected and output. Trigger files may be archived and/or removed once detected.

Instructions: Populate the Watch directory field with the directory to be scanned for trigger files. If the trigger file can appear in a sub directory directly below this "root" directory, then it is important to place a wild card in the Watch directory name to tell the system that it is necessary to traverse through the sub folder to search for the file. For example, to traverse the first directory the path could be something like "/foo/bar/*". This will instruct the system to search the first directory below "bar" for the trigger file. If the trigger file can be deeper in the tree than the first directory, it is necessary to add a second wild card "**" in order to instruct the system to search further into the sub folder level. Taking the first example, if we change the watch directory to "/foo/bar/**", the system will now search ALL directories below the watch directory for the trigger. If the trigger file can only appear in the root directory, it is not advantageous to use the wildcard for performance reasons.

Examples:

If watch directory = /foo/bar/ and pattern = *.txt the detected files can be /foo/bar/titi.txt but not /foo/bar/bar1/toto.txt and not /foo/bar/bar1/bar2/tutu.txt

If watch directory = /foo/bar/* and pattern = *.txt the detected files can be /foo/bar/bar1/toto.txt but not /foo/bar/titi.txt and not /foo/bar/bar1/bar2/tutu.txt

If watch directory = /foo/bar/** and pattern = *.txt the detected files can be /foo/bar/titi.txt and /foo/bar/bar1/toto.txt and /foo/bar/bar1/bar2/tutu.txt

Users can first check the multi_folder search box, and input the watch directory a string in one of the following three ways:

Once inputted, the plugin will loop through all folders looking for the file matching the pattern provided

In addition to this, folders that start with a DOT(.) are not searched because by default GLOB ignores the folders starting with DOT. In the example, where the directory is set to /foo/bar/*, and a directory such as /foo/bar/.tmp exists, then the Local File Watcher will not look inside this directory. If the existing directory is /foo/bar/tmp, then that directory will be searched as it is an acceptable replacement for *.

  1. Enter the file name or pattern for the trigger. Regarding file name, don't enter the full path, only the filename. Wild cards are permissible here so entering "*.txt" will result in all files with the ".txt" extension being identified as a trigger.
  2. Select "Use regex pattern matching" when more sophisticated pattern matching using regular expressions is required.
  3. Select the checkbox "Keep trigger on-going" if it is necessary to periodically scan for files arriving into the Watch directory and act upon their arrival.
  4. If it is OK to trigger on a partial file, select "Triggers on partial file". This will allow processing to begin before the trigger file has been completely updated.
  5. Select "Provide Content of Trigger File as additional output" if the contents of the file are required for later processing. Typical example of this may be a JSON or XML file that will require parsing later.
  6. To save copies of the trigger file, put the full path in the "Trigger files archive directory". Note that ownerships and permissions on these files will be set based upon the user executing Orchestrator and may well be owned by root.

    Placing a value in the "Trigger file name base" will mask off that path from the trigger file name. The use case is that the trigger files exist in directories below the Watch directory, and an archive directory is specified. If the directory(ies) below the Watch directory are not needed in the archive directory, they can be masked off here.

  7. Select "Add timestamp to archived copy" to append a timestamp at the end of the archived trigger files.
  8. Select "Remove trigger file" if the trigger file should be removed post processing.