Description
I'd like to start a discussion on including a file system globbing API in .NET (Core). If you look at implementations mentioned on Wikipedia, every "mainstream platform" has an entry, but not .NET.
There's quite a few (more or less) successful implementations around (see below), some even from Microsoft, but I think something as fundamental as this, should ship with the framework.
There's already partial globbing support using the following methods
Directory.GetFiles
Directory.EnumerateFiles
Directory.GetFileSystemEntries
Directory.EnumerateFileSystemEntries
Directory.GetDirectories
Directory.EnumerateDirectories
They all have a searchPattern
argument, but it lacks support for recursive globs (**
aka. "globstar"), brace expansion etc. This can be achieved using the SearchOption
argument, but the API is hard to use when you want to support (often user-defined) recursive patterns like /src/**/*.csproj
.
I'd ❤️ to hear people's opinions here...
- Is it worth including in the framework?
- Should new APIs be introduced, or can we "level up" the existing
searchPattern
in the methods mentioned above (without it being a breaking change)?
Examples
- MSBuild by @cdmihai
- Cake by @patriksvensson
- Minimatch (port from JS) by @SLaks
- Microsoft.Extensions.FileSystemGlobbing by @troydai
- Glob by @kthompson