Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A C# Glob library for .NET and .NET Core.

License

NotificationsYou must be signed in to change notification settings

kthompson/glob

Repository files navigation

Join the chat at https://gitter.im/kthompson/globBuild statusCoverageTestsNuget

A C# Glob library for .NET and .NET Core.

What is a glob?

A glob is a pattern-matching syntax that shells use. Like when you dorm *.cs, the*.cs is a glob.

See:http://en.wikipedia.org/wiki/Glob_(programming) for more info.

Supported Environments

  • Windows
  • Macintosh OS X (Darwin)
  • Linux

Supported Pattern expressions

PatternDescription
*matches any number of characters including none, excluding directory seperator
?matches a single character
[abc]matches one character in the brackets
[!abc]matches any character not in the brackets
**match zero or more directories
{abc,123}comma delimited set of literals, matched 'abc' or '123'

Usage

Example

varglob=newGlob("**/bin");varmatch=glob.IsMatch(@"C:\files\bin\");

Static Usage

Single file

varmatch=Glob.IsMatch(@"C:\files\bin\","**/bin");

Files in a directory

string[]matchingFiles=Glob.Files(@"C:\files\bin\","**/bin").ToArray();

Directories in a directory

string[]matchingDirectories=Glob.Directories(@"C:\files\bin\","**/bin").ToArray();

Extension Methods

DirectoryInfo.GlobDirectories

Enumerate through all matching directories recursively.

Params

  • pattern: String

Example

varroot=newDirectoryInfo(@"C:\");varallBinFolders=root.GlobDirectories("**/bin");

DirectoryInfo.GlobFiles

Enumerate through all matching files recursively.

Params

  • pattern: String

Example

varroot=newDirectoryInfo(@"C:\");varallDllFiles=root.GlobFiles("**/*.dll");

DirectoryInfo.GlobFileSystemInfos

Enumerate through all matching files and folders recursively.

Params

  • pattern: String

Example

varroot=newDirectoryInfo(@"C:\");varallInfoFilesAndFolders=root.GlobFileSystemInfos("**/*info");

Performance

See benchmarks

About

A C# Glob library for .NET and .NET Core.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors10


[8]ページ先頭

©2009-2025 Movatter.jp