Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9020549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:02:50+00:00 2026-06-16T05:02:50+00:00

I need to watch a folder (on a network share) and be notified when

  • 0

I need to watch a folder (on a network share) and be notified when a filename changes and the file is moved to a sub directory (all one event). This event occurs maybe twice a day. I will have multiple FileSystemWatchers to watch multiple folders for the same thing.

However, FileSystemWatcher is notoriously bad for missing events and I cannot have that happen. I’ve tried replicating the environment and it seems to work however I don’t know whether that’s because I am doing something in particular.

If I watch for only OnRenamed events, am I still likely to have issues or can I be sure that I won’t miss events?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:02:51+00:00Added an answer on June 16, 2026 at 5:02 am

    In a correctly working network, you should not have any error related to missing events, but you should be aware that a simple hiccup on you network will render your FileSystemWatcher monitoring useless.

    A momentary drop in the connection to the network share will trigger an Error in your FileSystemWatcher and even if the connection will be reestablished, the FileSystemWatcher will no longer receive any notification.

    This is a sligtly adapted example found on MSDN

    static void Main()
    {
        // Create a new FileSystemWatcher and set its properties.
        FileSystemWatcher watcher = new FileSystemWatcher();
        watcher.Path = @"\\yourserver\yourshare";
        watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
               | NotifyFilters.FileName | NotifyFilters.DirectoryName;
        // Only watch text files.
        watcher.Filter = "*.txt";
    
        // Add handler for errors.
        watcher.Error += new ErrorEventHandler(OnError);
    
        // Begin watching.
        watcher.EnableRaisingEvents = true;
    
        // Wait for the user to quit the program.
        Console.WriteLine("Press \'q\' to quit the sample.");
        while(Console.Read()!='q');
    }
    private static void OnError(object source, ErrorEventArgs e)
    {
        //  Show that an error has been detected.
        Console.WriteLine("The FileSystemWatcher has detected an error");
    
        //  Give more information if the error is due to an internal buffer overflow.
        Type t = e.GetException().GetType();
        Console.WriteLine(("The file system watcher experienced an error of type: " + 
                           t.ToString() + " with message=" + e.GetException().Message));
    }
    

    If you try to start this console application and then disable your network connection, you will see the Win32Exception, but if you do it again, no more error event will be seen by the running FileSystemWatcher

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a Windows Service to watch a folder on our network
In my iPhone OS application I want (need) to watch for changes in the
I have watch a folder that will create a new sub-folder use date as
In my app I need to watch a directory for new files. The amount
I'm currently using jpathwatch to watch for new files created in a folder. All
I need to watch properties for changes. Which method is better in terms of
i have this youtube url http://www.youtube.com/watch?v=9N51Etoikfw&feature=youtube_gdata i need to remove the feature parameter and
Need to apply a filter to a file like this: TUPAC_0006:1:1:2554:2356#0/1 0 * 0
I have to watch for any input given to or any changes that made
All – I need to carry out several tasks silently via Custom Actions. Essentially,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.