Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Watching Directory

Watching Directory

Scheduled Pinned Locked Moved C#
tutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rakesh_nits
    wrote on last edited by
    #1

    Hi All, Is there any better and reliable method to watch for directories then filesystemwatcher.I am watching all files and folders on fixed drives.The behaviour of filesystemwatcher is different for different files for example for a .txt file if something is changed it fires the change event two times.for .xls file change event will fire even if it had been just opened also sometimes it shows it as deleted and then renamed when there is nothing being changed in the file.for .mdb file the creation and change both event fires just on creation.Is there any other reliable method.Thanks in advance.

    D 1 Reply Last reply
    0
    • R rakesh_nits

      Hi All, Is there any better and reliable method to watch for directories then filesystemwatcher.I am watching all files and folders on fixed drives.The behaviour of filesystemwatcher is different for different files for example for a .txt file if something is changed it fires the change event two times.for .xls file change event will fire even if it had been just opened also sometimes it shows it as deleted and then renamed when there is nothing being changed in the file.for .mdb file the creation and change both event fires just on creation.Is there any other reliable method.Thanks in advance.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      This is not because the FileSystem watch treats different file types differently. You're actually getting some insights as to how those applications really behave! No matter what you use to monitor the file system, you'll see the same behaviors. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      R 1 Reply Last reply
      0
      • D Dave Kreskowiak

        This is not because the FileSystem watch treats different file types differently. You're actually getting some insights as to how those applications really behave! No matter what you use to monitor the file system, you'll see the same behaviors. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        R Offline
        R Offline
        rakesh_nits
        wrote on last edited by
        #3

        hi dave, thanks for that information.Actually I want to know when a particular file is being modified.even the File.GetLastWriteTime does not help as in the case of .xls file it gives me the last access time.and there are other files type also.is there any way by which i can find whenever any file is being modified.thanks in advance.

        D 1 Reply Last reply
        0
        • R rakesh_nits

          hi dave, thanks for that information.Actually I want to know when a particular file is being modified.even the File.GetLastWriteTime does not help as in the case of .xls file it gives me the last access time.and there are other files type also.is there any way by which i can find whenever any file is being modified.thanks in advance.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          "Being modified" can't be tracked. In the case of Notepad, it opens the file, reads it, then closes it. When the file is saved, the filename is opened, written, then closed. That's it. Excel/Word is almost the same way, but they involve saving to temp files, deleting the originals, and renaming the temps file to the old filenames. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups