A C# Glob library for .NET and .NET Core.
A glob is a pattern-matching syntax that shells use. Like when you do
rm *.cs
, the *.cs
is a glob.
See: http://en.wikipedia.org/wiki/Glob_(programming) for more info.
- Windows
- Macintosh OS X (Darwin)
- Linux
From all of my searching I have not been able to find a glob utility that works on Windows and *nix. If you need something that works on all platforms... This is what you need.
This is also a pure C# implementation.
var glob = new Glob("**/bin");
var match = glob.IsMatch(@"C:\files\bin\");
var match = Glob.IsMatch(@"C:\files\bin\", "**/bin");
Enumerate through all matching directories recursively.
- pattern: String
var root = new DirectoryInfo(@"C:\");
var allBinFolders = root.GlobDirectories("**/bin");
Enumerate through all matching files recursively.
- pattern: String
var root = new DirectoryInfo(@"C:\");
var allDllFiles = root.GlobFiles("**/*.dll");
Enumerate through all matching files and folders recursively.
- pattern: String
var root = new DirectoryInfo(@"C:\");
var allInfoFilesAndFolders = root.GlobFileSystemInfos("**/*info");