Class: DirectoryWatcher
A filesystem monitor.
Static Methods
DirectoryWatcher DirectoryWatcher.new(Path: string, Recursive?: boolean)
Properties
string Path [readonly]
The path targeted by this DirectoryWatcher.
boolean Recursive
Determines whether the DirectoryWatcher watches directories recursively or not. Defaults to true
unless explicitly specified otherwise in the constructor.
Events
DirectoryWatcher.OnChanged()
Fires on file contents being changed.
DirectoryWatcher.OnCreated()
Fires on a file being created.
DirectoryWatcher.OnDeleted()
Fires on a file being deleted.
DirectoryWatcher.OnRenamed()
Fires on a file being renamed.
DirectoryWatcher.OnOverflow()
This event is called when there are too many directory changes at once, and exists due to a fundamental flaw in the Windows API. An internal workaround is possible but would be relatively memory-intensive, so this is the "fix" used for now. It is called for every currently active DirectoryWatcher. Cases where this happens are relatively rare, but may still exist; e.g. in the case of batch depletions of large folders. Users are recommended to treat this as a change to every relevant file.