All Manuals > LispWorks® User Guide and Reference Manual > 48 Miscellaneous WIN32 symbols

monitor-directory-changes Function

Summary

Monitors a directory in the file system for changes.

Package

win32

Signature

monitor-directory-changes directory kinds change-callback &key monitor-subtree checker timeout

Arguments
directory
A pathname designator naming a directory.
kinds
A list of keywords.
change-callback
A function designator.
monitor-subtree
A generalized boolean.
checker
nil or a function designator.
timeout
nil or a positive real.
Description

The function monitor-directory-changes loops monitoring directory for changes in the file system.

kinds is a list of one or more of the keywords:

:file-name
Monitor changes to files names.
:dir-name
Monitor changes to directory names.
:attributes
Monitor changes to attributes.
:size
Monitor changes to file size.
:last-write
Monitor changes to write time.
:last-access
Monitor changes to last access times.
:creation
Monitor changes to creation times.
:security
Monitor changes to security-descriptors.

change-callback is called whenever any items specified by kinds change in directory (or in any subdirectories if monitor-subtree is non-nil). change-callback is called with the pathname of the item that has changed and a keyword specifying the change:

:added
The file/directory was added.
:removed
The file/directory was removed.
:modified
The file/directory was modified.
:renamed-old-name
The file/directory was renamed from this old name.
:renamed-new-name
The file/directory was renamed to this new name.

When checker is non-nil, it is called with no arguments every timeout seconds or when a change is detected. If checker returns nil, then monitor-directory-changes itself returns nil immediately. Otherwise, monitor-directory-changes never returns.

timeout is useful only when checker is non-nil. It defaults to 5 when checker is non-nil and otherwise it defauls to nil.


LispWorks® User Guide and Reference Manual - 18 Feb 2025 15:32:52