Directory Notifier
Last updated
Last updated
The Directory Notifier is able to monitor a folder and report back when a new file is present. It has several key checks in place to make sure the file isn't actively being written too, or locked by another application before executing the file ready callback.
Unlike the that expects the file to be processed out of the folder, notifier is intended to only signal that a file has been changed, added, or removed. It does not contain a failure policy because of this reason.
Directory Notifier is great for supporting hot-reload at runtime.
is great for file processing where the file is expected to be removed.
This demo will:
Watch the C:\Watch
folder.
It will report on any JSON files (.*\.json$
) - This uses and supports full Regex patterns.
It will search TopDirectoryOnly
(no subDirectories).
NotifyInitial is true
which tells the system to send notifications on all files currently in the path.
If this was false
, it would not call the callback with the pre-existing files.