TCnFileSystemWatcher.Filter Property
Gets or sets the filter string used to determine what files are monitored in a directory.
published
[Default('*.*')]
property Filter: String read GetFilter write SetFilter;
Property Value
The filter string. The default is "*.*" (Watches all files.)
To watch changes in all files, set the Filter property to an empty string (""). To watch a specific file, set the Filter property to the file name. For example, to watch for changes in the file MyDoc.txt, set the Filter property to "MyDoc.txt". You can also watch for changes in a certain type of file. For example, to watch for changes in any text files, set the Filter property to "*.txt". Use of multiple filters such as "*.txt|*.doc" is not supported.
The Filter property can be changed after the CnFileSystemWatcher object has started receiving events.
For more information about filtering out unwanted notifications, see the NotifyFilter, IncludeSubdirectories, and InternalBufferSize properties.
Filter accepts wildcards for matching files, as shown in the following examples.
Filter string | Watches the following files |
|---|---|
*.* | All files (default). An empty string ("") also watches all files. |
*.txt | All files with a "txt" extension. |
*recipe.doc | All files ending in "recipe" with a "doc" extension. |
win*.xml | All files beginning with "win" with an "xml" extension. |
Sales*200?.xls | Matches the following: |
MyReport.Doc | Watches only MyReport.doc |