Skip to content
Library for matching ant style paths, written in CSharp.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
AntPathMatching.Tests inject IFileSystem into AntDirectory Sep 21, 2018
AntPathMatching.sln Fixes spelling mistake "patch" => "path" in folders Feb 5, 2017

Ant Path Matching

Build status NuGet Join the chat at

Package for matching paths (files, directories) using the apache ant-style.


  • .NET Framework 2.0


Install the NuGet package using the command below:

Install-Package AntPathMatching

...or search for "AntPathMatching" in the NuGet index.

Getting started

The code below is an example how to use the library.

Standalone match

using AntPathMatching;
var ant = new Ant("/assets/**/*.{js,css}");
var isMatch = ant.IsMatch("/assets/scripts/vendor/angular.js");

Recursive match

using AntPathMatching;
var ant = new Ant("/assets/**/*.js");
var antDir = new AntDirectory(ant);
var matchingFiles = ant.SearchRecursively("C:\directory\", includeDirectoryPath: false);

Dependency Injection

using AntPathMatching;
	IAntFactory antFactory,				
	IAntDirectoryFactory antDirectoryFactory
) {
	var ant = antFactory.CreateNew("/assets/**/*.js");
	var antDir = antDirectoryFactory.CreateNew(ant);
You can’t perform that action at this time.