To track events such as changes to the contents of a directory, or modification of files in a directory, KOL has a special TDirChange object (located in the KOLadd.pas module). Its purpose is to trigger a designated event every time one of the changes specified by the watch filter occurs.
Constructor:
NewDirChangeNotifier(s, filter, watchsubtree, onchange)- creates and returns an object of type PDirChange (however, if the parameters are specified incorrectly, nil is returned). As a filter, you can specify the names of files, directories, attributes, file size, as well as the time of creation, modification and last access to files.
This object does not contain any essential properties or methods (perhaps you can mark the Path property, which stores the path to the monitored directory). The event that is called when a change is detected in the tracking area is set in the object's constructor. When it is triggered, the handler gets the path to the directory in which the change was detected (useful for the case when the object monitors the directory at once along with all subdirectories). In order to determine exactly what changes have occurred, the program must store information about the previous state of the directory, when changes occur, rescan the directory, and perform a comparison with its own code.