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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:03:40+00:00 2026-05-25T20:03:40+00:00

I have a problem with the FileSystemWatcher() Class. It works flawlessly when I’m monitoring

  • 0

I have a problem with the FileSystemWatcher() Class. It works flawlessly when I’m monitoring a local file on my harddrive. When I change to a mapped UNC, it does not fire anymore. The UNC is mapped to a local drive (X:), with the NET USE command where the user and password are supplied, this is done in a batch file at startup. Anyone that knows why this doesn’t work? I have checked the paths, all of them are correct, so the problem should be related to something else…

fw = new FileSystemWatcher();
        fw.Path = fileInfoPath;
        fw.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName;
        fw.Filter = fileInfoName;
        fw.Changed += new FileSystemEventHandler(FileOnChanged);
        fw.Created += new FileSystemEventHandler(FileOnChanged);

Help appreciated! 🙂

  • 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-25T20:03:40+00:00Added an answer on May 25, 2026 at 8:03 pm

    My solution to the problem was to leave the FileSystemWatcher() and create my own little watcher. It’s very simple, but the only thing I wanted to watch was when the file was rewritten and then perform some action.

    This is basically what I do (removed try/catch and some invoking of other threads):

    System.Threading.Timer tFileWatcher;
    private string fileTime1 = "";
    private string fileTime2 = "";
    //
    private void Form1_Load(object sender, EventArgs e)
        {
            tFileWatcher = new System.Threading.Timer(ComputeBoundOp2, 0, 0, 500);
            fileTime1 = File.GetLastWriteTime(fileInfo).ToFileTime().ToString();
            fileTime2 = File.GetLastWriteTime(fileInfo).ToFileTime().ToString();
        }
    
    private void ComputeBoundOp2(Object state)
        {
            fileTime2 = File.GetLastWriteTime(fileInfo).ToFileTime().ToString();
    
            if (fileTime1 != fileTime2)
            {
            //Do something
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a FileSystemWatcher monitoring a file on a network share. If an event
I have problem with TableView its empty. In (.h) file: @interface TableViewController : UITableViewController{
I have the following windows service file: Imports System.ServiceProcess Imports System.IO Public Class fswService
I have problem witch change style border-left-color in next button, if main button is
I have problem with consuming DbContext class in EF 4.3 CodeFirst approach. As for
I have written a FileProcessor class which wraps the FileSystemWatcher (fsw), and also has
I already managed to see file and folder changes with the FileSystemWatcher. My problem
I have problem with my Java program. How I read xml -file which has
I have problem in splitting data. I have data as follows in CSV file:
I have problem with casting in python. I have a method in file module_A.py:

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.