tool for testing glob patterns


Glob or shell globbing refers to the process of matching glob patterns to files in the filesystem. Best to illustrate it with an example: bash shell command cp *.jpg ./thumbnails will copy all files that have .jpg extension to the thumbnails folder. In that context *.jpg is the glob pattern and it will match all the files in the current working directory that have .jpg extension. Think of it as a pattern matching for the filesystem.

What is globster.xyz?

globster.xyz is a tool to test and visualise glob pattern matching. Type your glob pattern in the input field above and all matched files will be highlighted in blue in the tree directory structure. Use it to debug when your glob does not work or to experiment and learn from the provided examples. minimatch JavaScript library is used to evaluate glob patterns on this website.

Where is globbing used?

Globbing was first introduced in unix system. It is widely used in many tools these days. Gitignore file of the git version control system is one example. Patterns are used to exclude certain files and folders from being version controlled.

Syntax

Syntax depends on the particular implementation. Go to glob examples section for minimatch examples.

Glob implementations

There are many implementations in almost every programming language.

Javascript: minimatch, micromatch, extglob

Python: glob module

Linux: glob


If you have any question or suggestions please go to ask question section and start the discussion.

*- any character /- path separator **- all subdirectories {ts,js}- either ts or js

  • /myapp/config/*

    All files inside config directory

  • **/*.png

    All .png files in all directories

  • **/*.{png,ico,md}

    All .png, .ico or .md files in all directories

  • /myapp/src/**/*.ts

    All .ts files inside src directory (and all its subdirectories)

  • **/!(*.module).ts

    All .ts files but not .module.ts

To change files structure edit paths below and then click apply button.

apply