This topic has not yet been rated - Rate this topic

Directory.EnumerateFileSystemEntries Method

Returns an enumerable collection of file-system entries in a specified path.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method Static member EnumerateFileSystemEntries(String) Returns an enumerable collection of file-system entries in a specified path.
Public method Static member EnumerateFileSystemEntries(String, String) Returns an enumerable collection of file-system entries that match a search pattern in a specified path.
Public method Static member EnumerateFileSystemEntries(String, String, SearchOption) Returns an enumerable collection of file names and directory names that match a search pattern in a specified path, and optionally searches subdirectories.
Top
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
.NET 4 file Enumeration APIs throw unwanted exceptions and halt processing
When running as non-administrator, the new set of File system Enumeration APIs cannot be used to recursively enumerate files or folders in a reliable way.  This is because the system enumerators throw exceptions when they encounter an inaccessible folder.  Instead of ignoring the exception and moving on, the enumeration methods halt processing on the exception.  Please note that Microsoft is aware of this and working on a fix:

https://connect.microsoft.com/VisualStudio/feedback/details/512171/directory-enumeratedirectory-etc-unusable-due-to-frequent-unauthorizedaccessexceptions-even-runas-administrator?wa=wsignin1.0