What is Globbing?
The term "globbing" , is a programming concept that describes the process of using wildcards, for matching file paths.For example, the following bash shell command:
cp *.mp3 ./musicwill copy all files having .mp3 extension to the music folder.
In that context *.mp3 is the glob pattern and it will match all the files in the current working directory that have .mp3 extension.
What is this tool?
This tool visualize glob pattern matching so you can test glob patterns easily.Enter an glob pattern in the text field above and all matched files in the file tree will be highlighted in pinks.
Cheat Sheet
| Glob Pattern | Description | |
| **/images/**/*.{png,svg} | Match png and svg files within the images folder and its descendants | |
| /*.md | Match md files in the root folder | |
| *.{js,jsx,ts,tsx,md,html} | Match js, jsx, ts, tsx, md and html files in the root folder and its descendants | |
| **/license.* | Match files with the name license - regardless its extension | |
| **/!(*.min).js | Match js files in the root folder and its descendants, but dont match min.js files | |
| **/node_modules/!(vendor)/**.js | Match js files in the descendants of node_modules except the vendor folder | |
| /{,!(node_modules)/**/}*.{js,ts} | Match ts and js files in all of the folders recursively except node_modules |
About the Glob Pattern Tester
The Glob Pattern Tester is a free online tool for visualizing and testing glob pattern matching against a file tree structure.
Glob patterns are wildcard expressions used in programming, command-line tools, and configuration files to match groups of file paths. This tool lets you enter a glob pattern and instantly see which files in a sample directory tree would be matched, with matched files highlighted for clear visual feedback.
Whether you are writing build tool configurations, setting up file watchers, configuring linting rules, or crafting deployment scripts, this tool helps you verify that your glob patterns target exactly the files you intend before applying them in a real project.
Key Features
- Real-Time Pattern Matching:
As you type or modify the glob pattern, the file tree updates instantly to highlight all matching files. There is no need to click a button or wait for results. - Interactive File Tree:
Matched files are displayed within a hierarchical tree view that mirrors a real project directory structure, making it easy to visualize how patterns traverse folders and subfolders. - Editable File List:
Customize the file tree to match your own project structure. Add, remove, or rename files and directories to test patterns against a layout that mirrors your actual codebase. - Built-In Cheat Sheet:
A reference table of common glob patterns and their descriptions is provided alongside the tool. Click any example pattern to load it into the tester and see it in action immediately. - Common Pattern Examples:
Pre-loaded examples demonstrate patterns for matching specific file extensions, excluding directories, targeting nested paths, and using negation patterns. - Client-Side Processing:
All pattern matching and file tree rendering happens in your browser. No data is sent to any server, ensuring that your file structures and patterns remain private.
Understanding Glob Patterns
Glob patterns, also known as filepath expansion or glob matching, use special wildcard characters to match file and directory paths. They are widely used across programming tools and environments:
- * (Single Asterisk):
Matches any number of characters within a single path segment. For example,*.jsmatches all JavaScript files in a directory. - ** (Double Asterisk):
Matches any number of directories and subdirectories recursively. For example,**/*.tsmatches all TypeScript files at any depth in the tree. - ? (Question Mark):
Matches exactly one character. For example,file?.txtmatches file1.txt and fileA.txt but not file10.txt. - { } (Braces):
Matches any of the comma-separated patterns enclosed. For example,*.{js,ts}matches both .js and .ts files. - ! (Negation):
Excludes files matching the specified pattern. For example,**/!(*.min).jsmatches JavaScript files but excludes minified ones.
How to Use the Glob Pattern Tester
- Enter a Glob Pattern:
Type your glob pattern into the input field at the top of the page. The default pattern is/src/**/*.ts, which matches all TypeScript files in the src directory and its subdirectories. - Review the File Tree:
The file tree on the left side highlights all matching files. Matched files are visually distinguished from non-matching ones so you can quickly assess the pattern's behavior. - Edit the File List:
Switch to the file editor tab on the right side to modify the directory structure. Add new files, remove existing ones, or reorganize the tree to test patterns against different layouts. - Use the Cheat Sheet:
Browse the cheat sheet tab for common glob pattern examples. Click the play button next to any pattern to load it into the input field and see its matches. - Iterate and Refine:
Adjust your pattern and observe the changes in real time until the highlighted files match exactly what you need.
Best Practices
- Start Broad, Then Narrow:
Begin with a general pattern like**/*and progressively add specificity until only the desired files are matched. This approach helps you understand how each wildcard affects the results. - Test Exclusion Patterns:
When configuring tools that support negation (like .gitignore or bundler configs), verify your exclusion patterns here before applying them to avoid accidentally including or omitting files. - Mirror Your Project Structure:
For the most accurate testing, edit the file tree to match your actual project layout. This ensures the patterns you develop will behave identically when applied to your real codebase. - Use Braces for Multiple Extensions:
Instead of writing separate patterns for each file type, use brace expansion like*.{js,jsx,ts,tsx}to match multiple extensions in a single concise expression.
Common Use Cases
- Build Tool Configuration:
Test glob patterns for tools like Webpack, Vite, Rollup, and Gulp that use globs to define entry points, include paths, and file watchers. - Linting and Formatting:
Verify patterns for ESLint, Prettier, and Stylelint configuration files to ensure the correct files are included or excluded from analysis. - CI/CD Pipelines:
Test path filters used in GitHub Actions, GitLab CI, or other pipeline configurations that trigger builds based on changed file paths. - .gitignore Patterns:
Validate gitignore rules to confirm that the right files and directories are being excluded from version control. - TypeScript Configuration:
Test the include and exclude patterns in tsconfig.json to make sure your TypeScript compiler processes only the intended source files.
Frequently Asked Questions
What glob syntax does this tool support?
The tool supports standard glob syntax including single asterisk (*), double asterisk (**), question mark (?), brace expansion, and negation patterns. These cover the patterns used by most programming tools and build systems.
Can I test patterns against my own file structure?
Yes. The file editor tab allows you to modify the directory tree to match any project layout. You can add, remove, or rename files and folders to create a custom testing environment.
Is any data sent to a server?
No. All pattern matching and tree rendering happens entirely in your browser. Your file structures and glob patterns are never transmitted to any external service.
Why is my pattern not matching the expected files?
Common issues include missing the leading slash for root-level matching, forgetting to use ** for recursive directory traversal, or not accounting for file extensions. Use the cheat sheet examples as a reference to diagnose matching issues.
Related Tools
You might also find these tools useful:
- Bulk Rename Utility — Rename multiple files at once using various strategies.
- Duplicate File Finder — Find and remove duplicate files on your system.
- Encrypt File — Securely encrypt files with AES-256 encryption.
- Disk Space Analyzer — Scan folders and identify large files.