Overview
Script task to monitor given folder for file system change notifications. Various filters can be applied to refine the notifications. Variables can be set to store the name of the changed object. When such an event occurs, the script will populate the variable set in ExecValueVariable with a string containing the full path of the changed file or folder. Additional output variables can be set to receive the name of the changed object and in the case of name change, to receive the old name of the changed object.
NOTE: The script requires SSIS+ 2.2 version.
Setup
The task has the following parameters:
- Mode - work mode for the watcher process. Can be one of the following:
- Until Stopped - watcher will monitor the folder until an event occurs or is manually stopped.
- Until Date-Time - watcher will monitor the folder until date-time set by user.
- Until Variable - watcher will monitor the folder until date-time value provided by package variable.
- Fixed Time - watcher will monitor the folder for a period of time set by user in days, hours, minutes and seconds.
- UntilDateTime - date and time to stop the watcher. Available only when Mode = "Until Date-Time".
- UntilVariable - name of the package variable that will provide date and time to stop the watcher. Available only when Mode = "Until Variable".
- FixedTimeDays - days value for the fixed time mode. Must be 0 or greater. Available only when Mode = "Fixed Time".
- FixedTimeHours - hours value for the fixed time mode. Must be between 0 and 23. Available only when Mode = "Fixed Time".
- FixedTimeMinutes - minutes value for the fixed time mode. Must be between 0 and 59. Available only when Mode = "Fixed Time".
- FixedTimeSeconds - seconds value for the fixed time mode. Must be between 0 and 59. Available only when Mode = "Fixed Time".
- WatchFolder - the folder which will be monitored for file system changes. Must be a valid folder name.
- Filter - filter to apply to watch process. Only files and folders that match will be monitored.
*
and?
can be used. If left blank, all files and folders will trigger change notifications. - WatchEvents - events on the files and folders to watch for. Can be one or more of the following:
- Item Created - watcher will notify when a file or a folder is created.
- Item Deleted - watcher will notify when a file or a folder is deleted.
- File-Folder Name Changed - watcher will notify when file or folder is renamed.
- File Size Changed - watcher will notify when file size changes.
- Create Date Changed - watcher will notify when file or folder creation date changes.
- Last Access Date Changed - watcher will notify when file last access date changes.
- Last Write Date Changed - watcher will notify when file write date changes.
- Attribute Changed - watcher will notify when file or folder attribute changes.
- Security Changed - watcher will notify when file or folder security permissions change.
- IncludeSubfolders - indicator if sub-folders in the watch folder should be also monitored.
- IncludeHidden - Indicator if hidden files and folders should be also monitored. Has no effect when Watch Events is "Items Deleted".
- TypeFilter - types of file system objects to be monitored. Can be one or more of the following:
- Files - watcher will notify when file change occurs.
- Folders - watcher will notify when folder change occurs.
- OutFullPath - the package variable to receive the full path of the affected file or folder. Optional.
- OutOldFullPath - the package variable to receive the old file or folder name. Only populated when "File-Folder Name Changed" watch event is selected.
Configuration
To use this script, you would need to load it in COZYROC JavaScript Task. If you are using COZYROC SSIS+ 2.0 or later, after selecting the corresponding script type and opening the component editor, you can select the script from a dropdown list with the pre-built scripts. For COZYROC SSIS+ 1.9, you can download the JavaScript file and browse to it via the "Import JavaScript code" button.
![application/octet-stream](/modules/file/icons/application-octet-stream.png)
Knowledge Base
COZYROC SSIS+ Components Suite is free for testing in your development environment.
A licensed version can be deployed on-premises, on Azure-SSIS IR and on COZYROC Cloud.