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. monitoring directories

monitoring directories

Scheduled Pinned Locked Moved C#
jsonhelp
2 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, I want to watch all fixed drives on a computer.Is there any reliable way to do that.I am watching for create , delete , change , rename events for all files and folders.I am using filesystemwatcher but its not very reliable at all especially for high trafiic activity.I am using empty string for the filter property.I have changed internalbuffersize to 32 KB.I don't want to miss any event , if any event fires two or three times that is not a problem.I in the notifyfilters i have set that property to NotifyFilters.Size|NotifyFilters.LastAccess|NotifyFilters.LastWrite|NotifyFilters.FileName|NotifyFilters.DirectoryName|NotifyFilters.CreationTime|NotifyFilters.Attributes even after that i am having troubles with word documents especially when i write into a word document and save it sometimes it fires changed event and sometimes i am not able to get the event .it is not showing the internal buferoverflow exception on that time either.and when i am copying a large directory say having around 13000 files then internal buffer overflow exception occurs.on msdn site they have given that with a 4 KB buffer size we can watch change for around 80 files so may be i have to use very large buffer size.Is there any other Class or Win32 API available which can do the task so that I must be able to watch all the events and don't miss any event.Thanks in Advance.

    D 1 Reply Last reply
    0
    • R rakesh_nits

      Hi All, I want to watch all fixed drives on a computer.Is there any reliable way to do that.I am watching for create , delete , change , rename events for all files and folders.I am using filesystemwatcher but its not very reliable at all especially for high trafiic activity.I am using empty string for the filter property.I have changed internalbuffersize to 32 KB.I don't want to miss any event , if any event fires two or three times that is not a problem.I in the notifyfilters i have set that property to NotifyFilters.Size|NotifyFilters.LastAccess|NotifyFilters.LastWrite|NotifyFilters.FileName|NotifyFilters.DirectoryName|NotifyFilters.CreationTime|NotifyFilters.Attributes even after that i am having troubles with word documents especially when i write into a word document and save it sometimes it fires changed event and sometimes i am not able to get the event .it is not showing the internal buferoverflow exception on that time either.and when i am copying a large directory say having around 13000 files then internal buffer overflow exception occurs.on msdn site they have given that with a 4 KB buffer size we can watch change for around 80 files so may be i have to use very large buffer size.Is there any other Class or Win32 API available which can do the task so that I must be able to watch all the events and don't miss any event.Thanks in Advance.

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

      Without writing your monitoring code as an NTFS extension, no there is no reliable method to capture changes acrossed an entire volume. FileMon, from SysInternals, uses this technique. It requires a black belt in NTFS internals and Interop to implement though. The FileSystemWatcher relys on the NT Kernel function ReadDirectoryChangesW. This function is known to have more than a few problems, especially when monitoring remote directories. The problems just get worse, the bigger the directory tree you're monitoring. For more information, search for ReadDirectoryChangesW on MSDN. 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