/Vipentti.IO.Abstractions.FileSystemGlobbing

Additional abstractions to combine System.IO.Abstractions and Microsoft.Extensions.FileSystemGlobbing

Primary LanguageC#MIT LicenseMIT

Vipentti.IO.Abstractions.FileSystemGlobbing

A small utility library which enables using System.IO.Abstractions with Microsoft.Extensions.FileSystemGlobbing

Installation

dotnet add package Vipentti.IO.Abstractions.FileSystemGlobbing

Example

using System;
using System.IO.Abstractions;
using Microsoft.Extensions.FileSystemGlobbing;
using Vipentti.IO.Abstractions.FileSystemGlobbing;

namespace Example
{
    class Program
    {
        static void Main()
        {
            var fileSystem = new FileSystem();
            var matcher = new Matcher();
            // Find all text files in any directory under the current directory
            matcher.AddInclude("**/*.txt");

            var result = matcher.Execute(
                fileSystem,
                fileSystem.Directory.GetCurrentDirectory());

            foreach (var file in result.Files)
            {
                Console.WriteLine($"Found {file.Path}");
            }
        }
    }
}

License

MIT. See LICENSE.