Export (0) Print
Expand All

FileSystemWatcher.IncludeSubdirectories Property

Gets or sets a value indicating whether subdirectories within the specified path should be monitored.

Namespace:  System.IO
Assembly:  System (in System.dll)

[IODescriptionAttribute("FSW_IncludeSubdirectories")]
public bool IncludeSubdirectories { get; set; }

Property Value

Type: System.Boolean
true if you want to monitor subdirectories; otherwise, false. The default is false.

Set IncludeSubdirectories to true when you want to watch for change notifications for files and directories contained within the directory specified through the Path property, and its subdirectories. Setting the IncludeSubdirectories property to false helps reduce the number of notifications sent to the internal buffer. For more information on filtering out unwanted notifications, see the NotifyFilter and InternalBufferSize properties.

When true, IncludeSubdirectories is recursive through the entire sub tree, not just the immediate child directories. The relative path to a file or directory within the sub tree returns in the Name property of FileSystemEventArgs and the OldName property of RenamedEventArgs, depending on changes you are watching for. You can get the fully qualified path from the FullPath property of FileSystemEventArgs and the OldFullPath property of RenamedEventArgs, depending on the changes you are watching for.

If a directory is created in the sub tree of the directory you are watching, and IncludeSubdirectories is true, that directory will automatically be watched.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft