Forum guidelines
  • Home
  • »
  • C# Language
  • »
  • Folder monitoring - need to exclude changed folder from monitoring while performing actions
AuthorQuestion
Folder monitoring - need to exclude changed folder from monitoring while performing actions
Posted on: 15 Feb 2012
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! :)

AuthorReply
Re: Folder monitoring - need to exclude changed folder from monitoring while performing actions
Posted on: 19 Feb 2012  
You need to maintain/update some log files with information about the updated files.
Mark as Answer, on the posts reply's that helped you !!!.
Re: Folder monitoring - need to exclude changed folder from monitoring while performing actions
Posted on: 19 Feb 2012  
I am not sure what you need to do and I am not sure I understand what Suthish is saying.

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.

Thinking is a feeling; pleasant for some and unpleasant for others.

SPONSORED BY

Offshore Software and Database Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.