{"id":15823823,"url":"https://github.com/stefh/system.io.enhancedfilesystemwatcher","last_synced_at":"2025-06-12T12:37:53.331Z","repository":{"id":144154000,"uuid":"120129356","full_name":"StefH/System.IO.EnhancedFileSystemWatcher","owner":"StefH","description":"EnhancedFileSystemWatcher, which can be used to suppress duplicate events that fire on a single change to the file.","archived":false,"fork":false,"pushed_at":"2018-02-04T13:44:44.000Z","size":22,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T05:43:43.461Z","etag":null,"topics":["changed","deleted","file","filesystemwatcher","multiple","renamed","watcher"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StefH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-02-03T21:02:22.000Z","updated_at":"2022-05-21T01:13:13.000Z","dependencies_parsed_at":"2023-09-24T07:17:26.561Z","dependency_job_id":null,"html_url":"https://github.com/StefH/System.IO.EnhancedFileSystemWatcher","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"24d2919323c0dfd3ce9a796a9d8175c1be4b5fc4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FSystem.IO.EnhancedFileSystemWatcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FSystem.IO.EnhancedFileSystemWatcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FSystem.IO.EnhancedFileSystemWatcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FSystem.IO.EnhancedFileSystemWatcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StefH","download_url":"https://codeload.github.com/StefH/System.IO.EnhancedFileSystemWatcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243674670,"owners_count":20329140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["changed","deleted","file","filesystemwatcher","multiple","renamed","watcher"],"created_at":"2024-10-05T08:23:27.655Z","updated_at":"2025-03-15T02:30:56.917Z","avatar_url":"https://github.com/StefH.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# System.IO.EnhancedFileSystemWatcher\nAn EnhancedFileSystemWatcher, which can be used to suppress duplicate events that fire on a single change to the file.\n\nThis project is based on [Enhanced-FileSystemWatcher](https://www.codeproject.com/Articles/102493/Enhanced-FileSystemWatcher) which was written by [Vipul Prashar](https://www.codeproject.com/script/Membership/View.aspx?mid=1561441).\n\n## NuGet\n[![NuGet Badge](https://img.shields.io/nuget/v/EnhancedFileSystemWatcher)](https://www.nuget.org/packages/EnhancedFileSystemWatcher) \n\n## Frameworks\nThe following frameworks are supported:\n- net 2.0\n- net 4.5 and up\n- netstandard 1.3\n- netstandard 2.0\n\n# Information\n\n## Introduction\nThis project describes an enhanced FileSystemWatcher class which can be used to suppress duplicate events that fire on a single change to the file.\n\n## Background\nThe `System.IO.FileSystemWatcher` class helps the user to monitor a directory and multiple or single file within a directory. Whenever a change (Creation, Modification, Deletion or Renaming) is detected, an appropriate event is raised. However, duplicate events fire depending on the software that is being used to modify the file.\n\n## Observation\nUsing Notepad, modifying the contents of a file results in 2 Changed events being fired. Doing the same using Textpad results in 4 Changed events being fired.\n\nUsing Textpad, creating a file in a directory that was being watched resulted in 1 Created and 3 Changed events being fired. In case of Notepad, Created followed by Deleted!!, followed by Created and 3 Changed Events were observed.\n\n## Proposed Solution\nWe need to keep track of the event as they get fired and suppress subsequent events that occur within pre-determined interval.\n\n## Example\n``` c#\nclass Program\n{\n    static void Main(string[] args)\n    {\n        var fsw = new EnhancedFileSystemWatcher(@\"C:\\temp\", \"*.txt\");\n        fsw.Created += fsw_Created;\n        fsw.Changed += fsw_Changed;\n        fsw.Deleted += fsw_Deleted;\n        fsw.Renamed += fsw_Renamed;\n        fsw.EnableRaisingEvents = true;\n\n        Console.ReadLine();\n    }\n\n    static void fsw_Renamed(object sender, RenamedEventArgs e)\n    {\n        Console.WriteLine(\"Renamed: FileName - {0}, ChangeType - {1}, Old FileName - {2}\", e.Name, e.ChangeType, e.OldName);\n    }\n\n    static void fsw_Deleted(object sender, FileSystemEventArgs e)\n    {\n        Console.WriteLine(\"Deleted: FileName - {0}, ChangeType - {1}\", e.Name, e.ChangeType);\n    }\n\n    static void fsw_Changed(object sender, FileSystemEventArgs e)\n    {\n        Console.WriteLine(\"Changed: FileName - {0}, ChangeType - {1}\", e.Name, e.ChangeType);\n    }\n\n    static void fsw_Created(object sender, FileSystemEventArgs e)\n    {\n        Console.WriteLine(\"Created: FileName - {0}, ChangeType - {1}\", e.Name, e.ChangeType);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefh%2Fsystem.io.enhancedfilesystemwatcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefh%2Fsystem.io.enhancedfilesystemwatcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefh%2Fsystem.io.enhancedfilesystemwatcher/lists"}