Click here to Skip to main content
14,041,067 members
Click here to Skip to main content
Add your own
alternative version


1 bookmarked
Posted 11 Oct 2013
Licenced CPOL

Uses Of FileSystemWatcher

, 11 Oct 2013
Rate this:
Please Sign up or sign in to vote.
The FileSystemWatcher is responsible for to track the updates of either file or folder/sub-folders, Suppose if I would like to continuously monitor a

This articles was originally at but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

The FileSystemWatcher is responsible for to track the updates of either file or folder/sub-folders, Suppose if I would like to continuously monitor a folder , something like what are the newly added files or something like what are deleted files or which files are renamed such operations.

It’s not easy task to monitor a folder with old approach creates a service and use the Threading to continuously monitoring the folder. But with this approach needs more CPU and memory attention.

But with The FileSystemWatcher it’s quite easy.

We have one more advantage, Consider the below scenario. I have 2 applications

1.       Quoting application QA(Core Operations) only providing services to others it does not have any other information of any other applications.

2.       Broker application BA(it communicate with other applications by using services)

I have one functionality if user requested quoting from the Broker application and then request ends, user don’t wait till the Quoting application response, it’s like one way communication,  after the Quoting application service process all the requests done by broker application and responds appropriately , then how does Broker applications come to know which requests are done?

Approach 1: Call the BA services after QA completed the request. But with this approach QA doesn’t have any other application service end points. So in this way it won’t work out.

Approach 2: After process the BA request then create a xml file with request information and save it to some shared folder

And run the Windows service with File watcher service option and point out the folder path to the Shared folder path, Now handle the Created event and call the BA services accordingly to track the requested information.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

ASP.NET Community
United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.

The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
Group type: Collaborative Group

760 members

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web03 | 2.8.190425.1 | Last Updated 11 Oct 2013
Article Copyright 2013 by ASP.NET Community
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid