File Trigger Properties

The File Trigger Properties window allows you to view or modify the settings for a File Trigger.

Property Pages

File Selection

File Location

If the files you want to monitor are located on a local drive (a drive attached to the computer where the adTempus service is running) or on a network share (using a UNC path), choose "Local or Network File" as the File Location.

adTempus can also monitor files on a remote computer using an FTP or SFTP connection. To use this feature, select an existing File Service Provider or click the Add button to create a new one to provide the settings adTempus needs to connect to the server.

Files

Specify the files or directories to watch. You may specify a single file (e.g., "c:\data\jobtrigger.txt") or use wildcards (e.g., "c:\datafiles\newfiles\*.dat").

You may add as many file specifications as you wish. The job will be triggered when a file is found that matches any of the file specifications you have provided and matches all the other conditions you have specified.

The File Trigger cannot be used to monitor network drives mapped to a local drive letter. You must use the UNC path to the files rather than the drive letter. This is because drive letters mapped outside adTempus are not available to adTempus, and drive mappings you establish on the Resources page are not connected until after the job has been triggered. See the Network Access for Jobs topic for more information.

Polling Interval

Specify the interval at which adTempus will check for new, deleted, and modified files. At each polling interval, adTempus will take a snapshot of the target directory and compare it to the previous snapshot to determine which files have been created, deleted, or changed.

Set the polling interval to a smaller value if you need to respond quickly to file system changes, or a larger value if reaction time is not important.

Trigger Conditions

Select the conditions under which the job will be executed. You must select at least one option.

If the target files are located on a network drive or removable drive, adTempus will ignore the files if the drive is removed or disconnected. More information.

When you use the Trigger when file is modified option, be sure the Minimum Interval and/or Polling Interval options are set to appropriate values to avoid triggering the job continuously.

For example, suppose you are monitoring a log file for changes. The first time adTempus detects a change to the file, it will trigger your job. If the application that is writing to the log file continues to write to it, adTempus will continue to trigger your job each time it detects a change, so it will continue to trigger each time the Polling Interval elapses. If your polling interval is 5 seconds, adTempus will fire the job every 5 seconds.

Use the Wait for exclusive access and Wait until... options (on the Additional Options page) to prevent adTempus from triggering for a file that another application is still updating.

Trigger Mode

The Trigger Mode determines whether adTempus will start a single instance of the job, or multiple instances.

Each time the File Trigger scans the directories, it produces a list of all the files that meet the trigger criteria. Because adTempus makes this evaluation at regular intervals (rather than responding instantly to each change in the file system), it is possible for more than one file to meet the trigger criteria.

For example, suppose you have a trigger configured to fire any time files are added to a particular directory. In between evaluations of the directory, five new files are copied into the directory. On the next evaluation, adTempus will find those five files, and Trigger Mode setting determines how it will handle the scenario.

Trigger a single instance as soon as any matching file is found

If the Trigger Mode is set to "Trigger a single instance as soon as any matching file is found," adTempus will start a single instance of the job, even if more than one file has been found. The FileName job variable will contain the names of all the files found on the current evaluation pass.

Typically you would use this option if your program is being called to process an entire directory. For example, your program already has logic to scan an entire folder and process all the files in it; you only need adTempus to start it when there are files there to process.

In this scenario, you need to make sure you have configured the job so that it will not be triggered too often. For example, set the job's Multiple Instances rule to prevent duplicate instances of the job from being started at the same time. Otherwise, adTempus may trigger your program again while it is still processing files from the first trigger.

Include all matching files in FileName variable

When this option is checked, adTempus will still evaluate all files for matches, and the "FileName" Job Variable set by the trigger will contain a semicolon-delimited list of all matchin files. If this option is not checked, adTempus stops evaluating files as soon as it finds a matching file, and the FileName variable contains only the name of that file.

Trigger a separate instance for each matching file

If the Trigger Mode is set to "Trigger a separate instance for each matching file," adTempus will start a separate instance of the job for each of the matching files it has found, and each instance will have the FileName job variable set to the name of the file for which it is being executed.

Typically you would use this option if your program is being called to process files individually. For example, you need to run a data processing utility on each file that is uploaded into a directory. When you configure the Program Execution Task to run your program, you can include the token "%FileName%" in the command-line parameters, and adTempus will replace "%FileName%" with the name of the triggering file.

If the trigger is monitoring a directory and 5 files are added to it at once, adTempus will start 5 separate instances of the job (all running at the same time), each one linked to one of the files.

New feature iconTrigger a single instance once all file specifications have been met

If the Trigger Mode is set to "Trigger a single instance once all file specifications have been met," adTempus waits until all of the file specification rules are satisfied, and then triggers a single instance of the job. For example, if you have one File Specification that is set to wait for c:\inputs\file1.txt and a second File Specification that is set to wait for c:\chained results\processing results.log, then the job will not be started until both of those files are created.

Minimum Time Between Triggers

Specify the minimum time (in seconds) that must elapse after this trigger fires before adTempus will fire it again.

adTempus evaluates the files approximately every 10 seconds; specify a longer time if appropriate.

This option is not available if you have selected the Start a separate instance for each fileoption. When that option is checked, adTempus will always start a new instance of the job for each file that meets the trigger criteria.

You should use this option and/or the options available on the job to prevent duplicate instances to prevent your job from being triggered continually.

For example, suppose you are monitoring a log file for changes. The first time adTempus detects a change to the file, it will trigger your job. If the application that is writing to the log file continues to write to it, adTempus will continue to trigger your job each time it detects a change (it will check for changes roughly every 10 seconds).

See the File Trigger Overview topic for more information.

Additional Options

Wait for exclusive access to the file

If this option is checked, adTempus will not trigger the job until it can get exclusive access to the file (i.e., no other application is reading or writing the file). Note: In some cases it may be more reliable to watch the last modification timestamp instead (see next section), because the writing program may repeatedly close and then reopen the file while writing.

This option is not available for triggers that use FTP or SFTP.

New feature iconWait until __ seconds after the file's last modification

If this option is checked, adTempus will wait until the file has not been modified within the specified number of seconds before it triggers the job. This is used to ensure that adTempus does not trigger for a file that is still being written by another application. In some cases this option may be more reliable than the Wait for exclusive access option.

Capture the file

If this option is checked, adTempus will capture the file that satisfied the trigger and save it in the job history.

This option is not available for triggers that use FTP or SFTP.

Selection Script

You may specify a script that is to be run to determine whether a file should cause the job to trigger. When you specify a script, adTempus evaluates files as follows:

  1. It finds all files that match your file specifications.
  2. It discards any files that do not meet other selection criteria you have specified.
  3. For each remaining file, it calls the script you specify. Information about the file is passed to your script in Job Variables (see below) and in the Parameters.FoundFiles property object exposed to .NET scripts.
  4. Your script must return True if adTempus should trigger for the file or False if it should not.

Job Variables

The File Trigger sets the following Job Variables, which can be used by the selection script or by other scripts or notification messages in the job.

Variable Name Description
FileTrigger.FileName The full name (including path) of the file.
FileTrigger.FileSize The size of the file (in bytes).
FileTrigger.FileCreationTime The date/time at which the file was created.
FileTrigger.FileLastAccessTime The date/time at which the file was last accessed.
FileTrigger.FileLastWriteTime The date/time at which the file was last modified.
FileTrigger.FileAttributes An integer indicating the file's attributes.
FileTrigger.FileAction The action that caused the trigger: FileCreated, FileDeleted, or FileModified"

Related Concepts

File Trigger

Reference

File Specification Properties