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

  • SEARCH
  • Home
  • 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 8567019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:47:18+00:00 2026-06-11T17:47:18+00:00

I have a FileSystemWatcher that I would like to fire an OnCreated event for

  • 0

I have a FileSystemWatcher that I would like to fire an OnCreated event for every folder copied into the watched directory. Several folders will be copied into this watched directory at once, manually.

Currently it is only firing the event for the first folder copied.
So if I’m watching folder X and select folders A,B,C in windows explorer and copy them into X, OnCreated is fired for A but not B or C.

This is my code that I’m using to set up the FileSystemWatcher:

watcher = new System.IO.FileSystemWatcher(watchPath);            
watcher.InternalBufferSize = 32768;
watcher.IncludeSubdirectories = true;
watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | 
                       NotifyFilters.CreationTime | NotifyFilters.LastWrite;


watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnCreated);
watcher.EnableRaisingEvents = true;

and here is my OnCeated method

void OnCeated(object sender, FileSystemEventArgs e)
{            
    XDocument xmlDoc = BeginImport(e.FullPath); 
}

Any idea why this is only firing the event for the first folder copied into the watched directory?

  • 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-11T17:47:19+00:00Added an answer on June 11, 2026 at 5:47 pm

    From the documentation:

    The Windows operating system notifies your component of file changes in a buffer created by the FileSystemWatcher. If there are many changes in a short time, the buffer can overflow. This causes the component to lose track of changes in the directory, and it will only provide blanket notification. Increasing the size of the buffer with the InternalBufferSize property is expensive, as it comes from non-paged memory that cannot be swapped out to disk, so keep the buffer as small yet large enough to not miss any file change events. To avoid a buffer overflow, use the NotifyFilter and IncludeSubdirectories properties so you can filter out unwanted change notifications.

    It seems to be an internal limitation.

    I believe the act of pasting all three folder at once is considered “many changes in a short time” — can you use the NotifyFilter and leave out some events?

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

Sidebar

Related Questions

We have an asp.net mvc application that we would like to integrate a FileSystemWatcher
We have several .NET applications that monitor a directory for new files, using FileSystemWatcher.
I have a filesystemwatcher that will trigger an event when a file is modified.
I have an application that is using FileSystemWatcher to monitor a folder for changes
I have a FileSystemWatcher that react on the Changed event. I want to open
I have a FileSystemWatcher monitoring a directory that receives TIF files from a scanning
I have a project that uses the .net FileSystemWatcher to watch a Samba network
I have a FileSystemWatcher monitoring a file on a network share. If an event
I have a issue with my FileSystemWatcher. I have application that needs to monitor
We have built a window service that listens to folders with FileSystemWatcher , when

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.