{"id":74411,"date":"2022-09-19T08:33:13","date_gmt":"2022-09-19T06:33:13","guid":{"rendered":"https:\/\/drafts.code-maze.com\/?p=74411"},"modified":"2022-09-19T08:33:13","modified_gmt":"2022-09-19T06:33:13","slug":"csharp-filesystemwatcher","status":"publish","type":"post","link":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/","title":{"rendered":"FileSystemWatcher in C#"},"content":{"rendered":"<p>.NET provides a handy way to deal with monitoring different file system changes. In this article, we will discuss what FileSystemWatcher is, how to set it up, and how to configure it to observe various file system changes. In addition, we will take a look at the caveats of FileSystemWatcher.<\/p>\n<div style=\"padding: 20px; border-left: 5px #dc2323 solid; display: block; margin-bottom: 20px; box-shadow: 1px 1px 5px 0px lightgrey;\">To download the source code for this article, you can visit our <a href=\"https:\/\/github.com\/CodeMazeBlog\/CodeMazeGuides\/tree\/main\/files-csharp\/FileSystemWatcherExample\" target=\"_blank\" rel=\"nofollow noopener\">GitHub repository<\/a>.<\/div>\n<p>Let&#8217;s dig in.<\/p>\n<h2>What is FileSystemWatcher?<\/h2>\n<p><code>FileSystemWatcher<\/code> is a class in the <code>System.IO<\/code> namespace and it helps us monitor file system changes. It is composed of different properties that enable us to configure the event types we want to listen to. Also, we can apply file and directory filtering.<\/p>\n<p>Let&#8217;s inspect how we can set up the FileSystemWatcher in our project:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">public class TextFileManager\r\n{\r\n    private readonly FileSystemWatcher _fileSystemWatcher;\r\n\r\n    public TextFileManager(string rootDirectory)\r\n    {\r\n        _fileSystemWatcher = new FileSystemWatcher(rootDirectory);\r\n    }\r\n}<\/pre>\n<p>We can initialize <code>FileSystemWatcher<\/code> simply by passing the path, we want to monitor.\u00a0 Throughout this article, we will use our <code>TextFileManager<\/code> class to configure and work with <code>FileSystemWatcher<\/code> instance. <strong>Of course, you can always download our <\/strong><a href=\"https:\/\/github.com\/CodeMazeBlog\/CodeMazeGuides\/tree\/main\/files-csharp\/FileSystemWatcherExample\" target=\"_blank\" rel=\"nofollow noopener\">source code<\/a><strong> to see the full implementation.<\/strong><\/p>\n<h2>FileSystemWatcher Filters<\/h2>\n<p>There is a wide range of file system changes we can monitor using <code>FileSystemWatcher<\/code>. However, we can have a scenario where we don&#8217;t want to monitor all kinds of changes in our file system. Instead, we want to monitor specific file changes or specific file types. This is where filters are useful because they help us narrow down the type of changes we monitor. <code>FileSystemWatcher<\/code> <strong>contains two properties<\/strong>\u00a0<code>Filter<\/code> and <code>NotifyFilter<\/code> <strong>to configure filtering.<\/strong><\/p>\n<h3>Filter<\/h3>\n<p><code>Filter<\/code> is <code>FileSystemWatcher<\/code> property that enables us to monitor specific files by specifying a file pattern. <strong>The default Filter&#8217;s string value is<\/strong> <code>\"*.*\"<\/code>, which means to monitor all files.<\/p>\n<p>Let&#8217;s configure the type of files we want to monitor:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">private void ConfigureFilters()\r\n{\r\n    _fileSystemWatcher.Filter = \"*.txt\";\r\n}<\/pre>\n<p>Now <code>_fileSystemWatcher<\/code> monitors only text file changes.<\/p>\n<h3>NotifyFilter<\/h3>\n<p><code>NotifyFilter<\/code> <strong>is another property of<\/strong> <code>FileSystemWatcher<\/code> <strong>that enables us to specify and monitor specific changes in the file system.<\/strong> We can configure <code>NotifyFilter<\/code> to listen to multiple types of changes using the bitwise OR operator(<code>\"|\"<\/code>). By default, the value of <code>NotifyFilter<\/code> is a bitwise OR combination of <code>LastWrite<\/code>, <code>DirectoryName<\/code>, and <code>FileName<\/code>, but we can expand that:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">private void ConfigureFilters()\r\n{\r\n    ...\r\n    _fileSystemWatcher.NotifyFilter = NotifyFilters.Attributes\r\n                                | NotifyFilters.CreationTime\r\n                                | NotifyFilters.DirectoryName\r\n                                | NotifyFilters.FileName\r\n                                | NotifyFilters.LastAccess\r\n                                | NotifyFilters.LastWrite\r\n                                | NotifyFilters.Security\r\n                                | NotifyFilters.Size;\r\n}<\/pre>\n<p>By combining <code>NotifyFilters<\/code> enumeration we can expand the range of changes we monitor. The <code>NotifyFilters<\/code> enumeration values specify changes to monitor in a file or directory.<\/p>\n<p>The\u00a0 <code>Attributes<\/code> value adds the capability to monitor file or directory attribute changes. File or directory attributes are meta-data information that describes a file or a directory behavior (such as file visibility, modifiable, encryption, and more ).<\/p>\n<p><code>CreationTime<\/code> as its name suggests it enables us to monitor the file or a directory creation time.<\/p>\n<p>To monitor read or open operation on a file or directory we can use <code>LastAccess<\/code>.<\/p>\n<p>To monitor file or directory security settings (such as read-write permissions, execution, and share permission ) changes we simply add <code>Security<\/code> into the combination.<\/p>\n<p>In addition, if we want to monitor file or directory size changes that can happen as a result of file modification, we simply add <code>Size<\/code>.<\/p>\n<p>We can also monitor changes inside subdirectories by using the <code>IncludeSubdirectories<\/code> property:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">private void ConfigureFilters()\r\n{\r\n    ...\r\n    _fileSystemWatcher.IncludeSubdirectories = true;\r\n    ...\r\n}<\/pre>\n<h2>FileSystemWatcher Events<\/h2>\n<p><code>FileSystemWatcher<\/code> consists of 5 different event types we can use. Namely:\u00a0 <strong>Created<\/strong>, <strong>Deleted<\/strong>, <strong>Renamed, Error, <\/strong>and <strong>Changed.<br \/>\n<\/strong><\/p>\n<h3>Created<\/h3>\n<p>We can configure it to trigger an event on the creation of a file or a directory:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">private void ConfigureEvents()\r\n{\r\n    _fileSystemWatcher.Created += HandleCreated;\r\n}\r\n\r\nprivate void HandleCreated(object sender, FileSystemEventArgs e)\r\n{\r\n    Console.WriteLine($\"Create: {e.FullPath}\");\r\n}<\/pre>\n<h3>Deleted<\/h3>\n<p>We can configure it to trigger an event on the deletion of a file or directory:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">private void ConfigureEvents()\r\n{\r\n    _fileSystemWatcher.Deleted += HandleDeleted;\r\n    ...\r\n}\r\n\r\nprivate void HandleDeleted(object sender, FileSystemEventArgs e)\r\n{\r\n    Console.WriteLine($\"Delete: {e.FullPath}\");\r\n}<\/pre>\n<h3>Changed<\/h3>\n<p>We can configure it to trigger an event when there is a change to the size, system attributes, the last update, the last access time, or permission of a file or directory:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">private void ConfigureEvents()\r\n{\r\n    _fileSystemWatcher.Changed += HandleChanged;\r\n    ...\r\n}\r\n\r\nprivate void HandleChanged(object sender, FileSystemEventArgs e)\r\n{\r\n    Console.WriteLine($\"Change: {Enum.GetName(e.ChangeType)} {e.FullPath}\");\r\n}<\/pre>\n<p>The event handlers of\u00a0 <code>Created<\/code>, <code>Deleted<\/code> and <code>Changed<\/code> have similar method signatures.<\/p>\n<h3>Renamed<\/h3>\n<p>We can use it to trigger an event when there is a file name or directory name change:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">private void ConfigureEvents()\r\n{\r\n    _fileSystemWatcher.Renamed += HandleRenamed;\r\n   ...\r\n}\r\n\r\nprivate void HandleRenamed(object sender, RenamedEventArgs e)\r\n{\r\n    Console.WriteLine($\"Rename: {e.OldName} =&gt; {e.Name}\");\r\n}<\/pre>\n<p><code>Renamed<\/code> event handlers have a different method signature from <code>Created<\/code>, <code>Deleted<\/code>, and <code>Changed<\/code> event handlers. The second argument of type <code>RenamedEventArgs<\/code> contains the old name and new name properties of the affected file or directory.<\/p>\n<h3>Error<\/h3>\n<p>For different reasons <code>FileSystemWatcher<\/code> could reach a state where it can no longer monitor file system changes in the specified path. To trigger an event in this scenario we use the <code>Error<\/code> event handler:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">private void ConfigureEvents()\r\n{\r\n    _fileSystemWatcher.Error += HandleError; \r\n    ...\r\n}\r\n\r\nprivate void HandleError(object sender, ErrorEventArgs e)\r\n{\r\n    Console.WriteLine($\"Error: {e.GetException().Message}\");\r\n}<\/pre>\n<p>Finally, to enable <code>_fileSystemWatcher<\/code> to raise events, we have to set <code>EnableRaisingEvents<\/code> property to true:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">private void ConfigureEvents()\r\n{\r\n    ...\r\n    _fileSystemWatcher.EnableRaisingEvents = true;\r\n}<\/pre>\n<p><code>FileSystemWatcher<\/code> events are raised to corresponding file system changes inside the path being monitored and in accordance with the filters. It is important to note that common file system operations (such as move or copy) might trigger more than one event.<\/p>\n<h2>FileSystemWatcher Caveats<\/h2>\n<p><code>FileSystemWatcher<\/code> makes it easy to monitor our file system and trigger events accordingly. However, it is important to keep in mind when the buffer capacity is exceeded <code>FileSystemWatcher<\/code> can miss an event. The default buffer size is 8 KB, but we can set it to any value between 4 KB and 64 KB using <code>InternalBufferSize<\/code> property. The buffer is storage for all system notifications that relate to file changes and exclude file names. Each event can use up to 16 bytes of memory. <strong>If numerous changes take place in a short time it can cause a buffer overflow, as a result,<\/strong> <code>FileSystemWatcher<\/code><strong> misses subsequent events<\/strong>.<\/p>\n<p>To avoid buffer overflow:<\/p>\n<ul>\n<li>Minimize the types of changes we want to monitor using <code>NotifyFilter<\/code> and <code>IncludeSubdirectories<\/code><\/li>\n<li>Monitor only the files that are of interest by specifying the file pattern, more importantly, avoid monitoring files with long names as they have a high contribution to filling up the buffer<\/li>\n<li>To have more room in the buffer, increase the buffer size by setting <code>InternalBufferSize<\/code> property<\/li>\n<li>Keep the event handler code to the possible minimum<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>In this article, we have learned how we can monitor a file system using <code>FileSystemWatcher<\/code>, how to configure the different events, ways of filtering, and finally the caveats and recommendations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>.NET provides a handy way to deal with monitoring different file system changes. In this article, we will discuss what FileSystemWatcher is, how to set it up, and how to configure it to observe various file system changes. In addition, we will take a look at the caveats of FileSystemWatcher. Let&#8217;s dig in. What is [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":62189,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[12],"tags":[931,1429,538,1430],"class_list":["post-74411","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-csharp","tag-events","tag-filesystemwatcher","tag-filters","tag-track-changes-in-files","et-has-post-format-content","et_post_format-et-post-format-standard"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FileSystemWatcher in C# - Code Maze<\/title>\n<meta name=\"description\" content=\"In this article, we are going to learn about FileSystemWatcher in C# and how we can use it to monitor file system changes.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FileSystemWatcher in C# - Code Maze\" \/>\n<meta property=\"og:description\" content=\"In this article, we are going to learn about FileSystemWatcher in C# and how we can use it to monitor file system changes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/\" \/>\n<meta property=\"og:site_name\" content=\"Code Maze\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-19T06:33:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1100\" \/>\n\t<meta property=\"og:image:height\" content=\"620\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Code Maze\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/CodeMazeBlog\" \/>\n<meta name=\"twitter:site\" content=\"@CodeMazeBlog\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Code Maze\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/\"},\"author\":{\"name\":\"Code Maze\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/09d29b223012c8e94a68ba62861d0b04\"},\"headline\":\"FileSystemWatcher in C#\",\"datePublished\":\"2022-09-19T06:33:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/\"},\"wordCount\":910,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"keywords\":[\"events\",\"FileSystemWatcher\",\"Filters\",\"Track changes in files\"],\"articleSection\":[\"C#\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/\",\"url\":\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/\",\"name\":\"FileSystemWatcher in C# - Code Maze\",\"isPartOf\":{\"@id\":\"https:\/\/code-maze.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"datePublished\":\"2022-09-19T06:33:13+00:00\",\"description\":\"In this article, we are going to learn about FileSystemWatcher in C# and how we can use it to monitor file system changes.\",\"breadcrumb\":{\"@id\":\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#primaryimage\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png\",\"width\":1100,\"height\":620,\"caption\":\"C# Development\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/code-maze.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FileSystemWatcher in C#\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/code-maze.com\/#website\",\"url\":\"https:\/\/code-maze.com\/\",\"name\":\"Code Maze\",\"description\":\"Learn. Code. Succeed.\",\"publisher\":{\"@id\":\"https:\/\/code-maze.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/code-maze.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/code-maze.com\/#organization\",\"name\":\"Code Maze\",\"url\":\"https:\/\/code-maze.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png\",\"width\":3511,\"height\":3510,\"caption\":\"Code Maze\"},\"image\":{\"@id\":\"https:\/\/code-maze.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/CodeMazeBlog\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/09d29b223012c8e94a68ba62861d0b04\",\"name\":\"Code Maze\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/code-maze.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png\",\"contentUrl\":\"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png\",\"caption\":\"Code Maze\"},\"description\":\"This is the standard author on the site. Most articles are published by individual authors, with their profiles, but when several authors have contributed, we publish collectively as a part of this profile.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/codemaze\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/CodeMazeBlog\"],\"url\":\"https:\/\/code-maze.com\/author\/codemazecontributor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FileSystemWatcher in C# - Code Maze","description":"In this article, we are going to learn about FileSystemWatcher in C# and how we can use it to monitor file system changes.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/","og_locale":"en_US","og_type":"article","og_title":"FileSystemWatcher in C# - Code Maze","og_description":"In this article, we are going to learn about FileSystemWatcher in C# and how we can use it to monitor file system changes.","og_url":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/","og_site_name":"Code Maze","article_published_time":"2022-09-19T06:33:13+00:00","og_image":[{"width":1100,"height":620,"url":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","type":"image\/png"}],"author":"Code Maze","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/CodeMazeBlog","twitter_site":"@CodeMazeBlog","twitter_misc":{"Written by":"Code Maze","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#article","isPartOf":{"@id":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/"},"author":{"name":"Code Maze","@id":"https:\/\/code-maze.com\/#\/schema\/person\/09d29b223012c8e94a68ba62861d0b04"},"headline":"FileSystemWatcher in C#","datePublished":"2022-09-19T06:33:13+00:00","mainEntityOfPage":{"@id":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/"},"wordCount":910,"commentCount":0,"publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"image":{"@id":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","keywords":["events","FileSystemWatcher","Filters","Track changes in files"],"articleSection":["C#"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/code-maze.com\/csharp-filesystemwatcher\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/","url":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/","name":"FileSystemWatcher in C# - Code Maze","isPartOf":{"@id":"https:\/\/code-maze.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#primaryimage"},"image":{"@id":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#primaryimage"},"thumbnailUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","datePublished":"2022-09-19T06:33:13+00:00","description":"In this article, we are going to learn about FileSystemWatcher in C# and how we can use it to monitor file system changes.","breadcrumb":{"@id":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/code-maze.com\/csharp-filesystemwatcher\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#primaryimage","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2021\/12\/social-csharp.png","width":1100,"height":620,"caption":"C# Development"},{"@type":"BreadcrumbList","@id":"https:\/\/code-maze.com\/csharp-filesystemwatcher\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/code-maze.com\/"},{"@type":"ListItem","position":2,"name":"FileSystemWatcher in C#"}]},{"@type":"WebSite","@id":"https:\/\/code-maze.com\/#website","url":"https:\/\/code-maze.com\/","name":"Code Maze","description":"Learn. Code. Succeed.","publisher":{"@id":"https:\/\/code-maze.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/code-maze.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/code-maze.com\/#organization","name":"Code Maze","url":"https:\/\/code-maze.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez.png","width":3511,"height":3510,"caption":"Code Maze"},"image":{"@id":"https:\/\/code-maze.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/CodeMazeBlog"]},{"@type":"Person","@id":"https:\/\/code-maze.com\/#\/schema\/person\/09d29b223012c8e94a68ba62861d0b04","name":"Code Maze","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/code-maze.com\/#\/schema\/person\/image\/","url":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png","contentUrl":"https:\/\/code-maze.com\/wp-content\/uploads\/2020\/01\/Code-Maze-Only-Logo-Transparent-HRez-150x150.png","caption":"Code Maze"},"description":"This is the standard author on the site. Most articles are published by individual authors, with their profiles, but when several authors have contributed, we publish collectively as a part of this profile.","sameAs":["https:\/\/www.linkedin.com\/company\/codemaze\/","https:\/\/x.com\/https:\/\/twitter.com\/CodeMazeBlog"],"url":"https:\/\/code-maze.com\/author\/codemazecontributor\/"}]}},"_links":{"self":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/74411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/comments?post=74411"}],"version-history":[{"count":3,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/74411\/revisions"}],"predecessor-version":[{"id":75037,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/posts\/74411\/revisions\/75037"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media\/62189"}],"wp:attachment":[{"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/media?parent=74411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/categories?post=74411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-maze.com\/wp-json\/wp\/v2\/tags?post=74411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}