Everywhere I find these two lines of code used to set filter for file system watcher in samples provided..
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Filter = "*.txt";
//or
watcher.Filter = "*.*";
But I want my watcher to monitor more file types, but not all. How can I achieve this:
//watcher.Filter = "*.txt" | "*.doc" | "*.docx" | "*.xls" | "*.xlsx";
I tried these:
watcher.Filter = "*.txt|*.doc|*.docx|*.xls|*.xlsx";
// and
watcher.Filter = "*.txt;*.doc;*.docx;*.xls;*.xlsx*";
Both did not work. This is just basics but I miss it. Thanks..
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…