Hi guys,
Don't know if the subject was any good, but...I have a bunch of folders I monitor using FileSystemWatcher. When files change in a folder I need to do some processing on the remaining files - which means I will change the folder. This results in a loop going on until the buffer is full or something.
Is there a way to stop monitoring just this folder, or even this folder+subfolders, while working on it? I cannot stop monitoring the other folders in the tree as they might change in the mean time (which would mean I would have to scan the whole tree again.
Any solution would be greatly appreciated! Cheers! :)
Folder monitoring - need to exclude changed folder from monitoring while performing actions
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Suthish NairRank #92 · 22.8K reputationPosted Feb 19, 2012, 11:35 AM EST
Sam HobbsRank #108 · 20.5K reputationPosted Feb 19, 2012, 5:26 PM EST
If I understand you then what you can do is to have a list of directories that you are currently processing and then when FileSystemWatcher says a directory has changed then if that directory is in the list then ignore it. Or more precisely, whenever you change something, put it in a queue and then when FileSystemWatcher says it is being changed, remove it from the queue and don't do anything more for that change notification. Assuming that there can be only one file at a time that is relevant, then you only need to do this for one file at a time.