File Watcher Job

The File Watcher job, Job:FileWatcher, enables you to detect the creation or deletion of a file in the time frame that you define.

The following example shows how to define a File Watcher job with both of the available AAPI commands—Job:FileWatcher:Create and Job:FileWatcher:Delete.

Copy
{
   "FWJobCreate"
   {
      "Type" : "Job:FileWatcher:Create",
      "RunAs":"controlm",
      "Path" : "C:/path*.txt",
      "SearchInterval" : "45",
      "TimeLimit" : "22",
      "StartTime" : "201705041535",
      "StopTime" : "201805041535",
      "MinimumSize" : "10B",
      "WildCard" : true,
      "MinimalAge" : "1Y",
      "MaximalAge" : "1D2H4MIN"
   },
   "FWJobDelete"
   {
      "Type" : "Job:FileWatcher:Delete",
      "RunAs":"controlm",
      "Path" : "C:/path.txt",
      "SearchInterval" : "45",
      "TimeLimit" : "22",
      "StartTime" : "201805041535",
      "StopTime" : "201905041535"
   }
}

The following table describes the File Watcher job parameters.

Parameter

Description

Path

Defines the pathname of the file that is detected.

You can use any of the following wildcards:

  • *: One or more characters.

  • ?: One character.

SearchInterval

Defines the number of seconds between successive attempts to detect a file creation or deletion.

TimeLimit

Determines the maximum amount of time, in minutes, to execute the process without detecting the file at its minimum size (for Job:FileWatcher:Create) or detecting its deletion (for Job:FileWatcher:Delete). If the file is not detected or deleted in this specified time frame, the process terminates with an error return code.

Default: 0 (no time limit)

StartTime

Determines the time when File Watcher starts to monitor the file, as follows:

  • HHMM: Determines the time for the current date.

  • yyyymmddHHMM: Determines the time for a different date.

201805041535: File Watcher starts to watch for the file at 3:35 PM on 4 May 2018.

StopTime

Determines when File Watcher stops monitoring the file, as follows:

  • HHMM: Determines the time for the current date.

  • yyyymmddHHMM: Determines the time for a different date.

MinimumSize

Defines the minimum file size that File Watcher monitors, in the following format:

<Number><File_Size>

where File_Size is any of the following sizes:

  • B: Bytes

  • KB: Kilobytes

  • MB: Megabytes

  • GB: Gigabytes

If the pathname contains wildcards, File Watcher monitors for the minimum file size only when you set the Wildcard parameter to true.

Wildcard

Determines whether File Watcher monitors for the minimum file size of a file when the pathname contains wildcards.

Valid Values:

  • true

  • false

Default: false

MinimalAge

(Optional) Determines the minimum amount of time that must have passed since the file was last modified.

  • 2Y10M3D5H: 2 years, 10 months, 3 days, and 5 hours must pass before the file is watched.

  • 2H10Min: 2 hours and 10 minutes must pass before the file is watched.

MaximalAge

(Optional) Determines the maximum amount of time that can pass since the file was last modified.

  • 2Y10M3D5H: After 2 years, 10 months, 3 days, and 5 hours, file watcher stops watching the file.

  • 2H10Min: After 2 hours and 10 minutes, file watcher stops watching the file.