![]() ![]() For more information, see Watching a Single File or Watching Multiple Files. You can watch a single or multiple files. Rules can be provided in the command line or by a rule file. Running as a utility: ctmfw is invoked from the command line. For more information, see Usage as a Service. Service: ( Windows only) As a service, ctmfw takes its parameters (rules) during startup from the rull.dat file whose full path name is specified in \data\ctmfw.cfg. For more information, see Watching a Single File and Watching Multiple Files. The ctmfw utility runs from the command line to detect a single file or multiple files. DO actions can consist of adding or deleting events or executing a command.įile creation: The file size is ignored if a wildcard is specified as part of the file name unless the mon_size_wildcard parameter is set to Y.įile deletion: ctmfw must first detect the existence of the file before it can detect its deletion. When the file reaches a specified minimum size and does not increase in size for a specified period of time, the File Watcher utility either finishes with a status of OK or executes a specified DO action. The ctmfw utility does the following:įile transfer activity: When the file is detected, the job continues to monitor the size of the file. ![]() The process waits for the creation or deletion of a specified file. The ctmfw utility runs as a process on the Agent host computer. # find the path to the desktop folder: $desktop = :: GetFolderPath ( 'Desktop' ) # specify the path to the folder you want to monitor: $Path = $desktop # specify which files you want to monitor $FileFilter = '*' # specify whether you want to monitor subfolders as well: $IncludeSubfolders = $true # specify the file or folder properties you want to monitor: $AttributeFilter = :: FileName, :: LastWrite # specify the type of changes you want to monitor: $ChangeTypes = :: Created, :: Deleted # specify the maximum time (in milliseconds) you want to wait for changes: $Timeout = 1000 # define a function that gets called for every change: function Invoke-SomeAction # subscribe your event handler to all event types that are # important to you.The Control-M Fire Watcher utility does not detect files with a modify time older than 50 years. ![]() Whenever a change is detected, Invoke-SomeAction is called. This is straight-forward: the script below monitors your desktop and all of its subfolders for new files and for deletion of files. However, responding to events is not trivial in a single-threaded environment like PowerShell. This way, you cannot miss change events because the FileSystemWatcher is constantly monitoring. Instead, whenever a change occurs, an event is fired, and your script can respond to the events.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |