Back to Dotnet

PACKAGE

src/libraries/Microsoft.Extensions.FileSystemGlobbing/src/PACKAGE.md

11.0.1001.8 KB
Original Source

About

<!-- A description of the package and where one can find more documentation -->

Provides support for matching file system names/paths using glob patterns.

Key Features

<!-- The key features of this package -->
  • Contains the Matcher type, which can be used to match files in the file system based on user-defined patterns.

How to Use

<!-- A compelling example on how to use this package with code, as well as any specific guidelines for when to use the package -->

Get all matching files:

c#
using Microsoft.Extensions.FileSystemGlobbing;

Matcher matcher = new();
matcher.AddIncludePatterns(new[] { "*.txt", "*.asciidoc", "*.md" });

string searchDirectory = "../starting-folder/";

IEnumerable<string> matchingFiles = matcher.GetResultsInFullPath(searchDirectory);

// Use matchingFiles if there are any found.
// The files in this collection are fully qualified file system paths.

Main Types

<!-- The main types provided in this library -->

The main types provided by this library are:

  • Microsoft.Extensions.FileSystemGlobbing.Matcher

Additional Documentation

<!-- Links to further documentation. Remove conceptual documentation if not available for the library. -->

Feedback & Contributing

<!-- How to provide feedback on this package and contribute to it -->

Microsoft.Extensions.FileSystemGlobbing is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.