public static IEnumerable <FileSystemInfo> FilesAndDirectories(DirectoryInfo workingDirectory, string pattern) { var glob = new Glob(pattern, GlobOptions.Compiled); var truncateLength = workingDirectory.FullName.Length + 1; return(workingDirectory.EnumerateFileSystemInfos("*", SearchOption.AllDirectories) .Where(info => glob.IsMatch(info.FullName.Remove(0, truncateLength)))); }
public int GlobGlob() { int matches = 0; foreach (var pattern in Globs) { var sut = new G.Glob(pattern, G.GlobOptions.Compiled); foreach (var path in FileList) { if (sut.IsMatch(path)) { matches++; } } } return(matches); }