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 4616686
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:01:06+00:00 2026-05-22T02:01:06+00:00

I am trying to use the FileSystemWatcher – and am having some luck.. The

  • 0

I am trying to use the FileSystemWatcher – and am having some luck..

The goal is to MOVE the file that gets created, from the monitored folder, to a new folder.

But… have hit 2 snags. Firstly, if I move 3 files into a folder at once (Select 3 files, ctrl+x, and then ctrl+c into my Monitor Folder), the monitor only triggers for the first file. The other 2 don’t get processed.

            FileSystemWatcher fsw = new FileSystemWatcher(FolderToMonitor);
        fsw.Created += new FileSystemEventHandler(fsw_Created);

        bool monitor = true;

        while (monitor)
        {
            fsw.WaitForChanged(WatcherChangeTypes.All, 2000);
            if (Console.KeyAvailable)
            {
                monitor = false;
            }
        }

        Show("User has quit the process...", ConsoleColor.Yellow);
        Console.ReadKey();

Is there a way to make it see all 3?

Secondly, if I move a file into the monitor folder, from a different drive, it takes a few seconds to copy the file into the folder. However, the monitor triggers as soon as the file starts copying in.. so therefore, is read only, and not ready to be moved.

Is there a way I can wait for the file to complete it’s copy into the monitor folder, before I process it?

  • 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-05-22T02:01:06+00:00Added an answer on May 22, 2026 at 2:01 am

    According to the msdn 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.

    Perhaps that explains your issue?
    Also note that cutting and pasting files from one directory to another is basically a mere renaming operation, therefore you should use the Renamed event to detect them.

    As for your other problem: try using the Changed event together with Created, as I believe both will be raised exactly once for a file (note that moving a file from another drive in not a simple renaming operation: it’s copy and delete), so the Changed event should indicate when the file copy operation has been completed (i.e. it won’t fire until the file is complete).

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

Sidebar

Related Questions

I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
Trying to use GnuPG with Delphi (Win32). I need to sign some file with
I am trying use javascript regular expressions to do some matching and I found
I'm implementing some dialogs that need a common poll to get fresh values from
I am trying use std::copy to copy from two different iterator. But during course
I'm trying use to selenium with firefox on CentOS from command line like this:
I'm trying use eco for client-side templating. I have multiple .eco templates that I'd
i'm trying use webview to load a image from sdcard i use this path
I have a regex that I'm trying use to validate against strings. Trying to
I have a 3rd party DLL that I am trying to use in a

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.