The pattern rules for glob are not regular expressions. Instead, they follow standard Unix path expansion rules. There are only a few special characters: two different wild-cards, and character ranges are supported [from pymotw: glob – Filename pattern matching].

So you can exclude some files with patterns.
For example to exclude manifests files (files starting with _) with glob, you can use:

files = glob.glob('files_path/[!_]*')
Answer from Kenly on Stack Overflow
🌐
Baeldung
baeldung.com › home › scripting › how to exclude a pattern from glob match in shell
How to Exclude a Pattern From Glob Match in Shell | Baeldung on Linux
March 18, 2024 - It’s important to note that GLOBIGNORE isn’t supported in all shells. However, it’s commonly found in Bash and some other Bourne-like shells. In this article, we’ve learned how to exclude a pattern from a glob match in the shell.
Discussions

How to exclude folders when include follows a glob pattern?
Using globs, you would normally have a second exclusion glob that uses the ! operator - so !**/__tests__/**. But tsconfig also has an exclude field you can use to do this, and just put a normal glob (”exclude”: [“**/__tests__/**”]) More on reddit.com
🌐 r/typescript
1
4
June 12, 2020
New in v2.1: exclude files with globs
PhotoStructure’s directory walker was rewritten in v2.1 to add glob support. What’s this? PhotoStructure comes built-in with several hundred exclusion patterns to avoid walking into system and application support directories. Read more about this here. If any of these patterns cause your ... More on forum.photostructure.com
🌐 forum.photostructure.com
8
0
May 6, 2022
[SOLVED] How to exclude using glob?
I am using glob to get a list of files in a directory. Problem is, I can't figure out how to exclude certain files with a certain pattern. This grabs all files with ()string in their name: foreach(glob("(*)*.*") as $file) That's works fine (obviously not full code)- but how do I make it now exclu... More on forums.phpfreaks.com
🌐 forums.phpfreaks.com
11
October 29, 2013
node.js - Glob matching, exclude all JS files - Stack Overflow
How can I modify the glob search string to behave as I'd like? ... No, sadly this is not Regex, but rather extglob syntax. ... Sign up to request clarification or add additional context in comments. ... Worked like a charm. For future stragglers, this caused a problem where my .json manifest file was also being excluded... More on stackoverflow.com
🌐 stackoverflow.com
🌐
PhotoStructure
forum.photostructure.com › ✨ tips
New in v2.1: exclude files with globs - ✨ Tips - PhotoStructure Forum
May 6, 2022 - PhotoStructure’s directory walker was rewritten in v2.1 to add glob support. What’s this? PhotoStructure comes built-in with several hundred exclusion patterns to avoid walking into system and application support directories. Read more about this here. If any of these patterns cause your files to be ignored, or you’re already using some other naming convention to exclude directories (instead of, for example, NoMedia), the new-to-v2.1 excludeGlobsOmit and excludeGlobsAdd settings should give ...
🌐
Visual Studio Code
code.visualstudio.com › docs › editor › glob-patterns
Glob Patterns Reference
November 3, 2021 - Visual Studio Code uses glob patterns in many components. Examples include setting file and folder includes/excludes in features such as Search, hiding files from the File Explorer or marking them readonly, and setting up programming language-specific file associations.
🌐
PHP Freaks
forums.phpfreaks.com › php coding › php coding help
[SOLVED] How to exclude using glob? - PHP Coding Help - PHP Freaks
October 29, 2013 - I am using glob to get a list of files in a directory. Problem is, I can't figure out how to exclude certain files with a certain pattern. This grabs all files with ()string in their name: foreach(glob("(*)*.*") as $file) That's works fine (obviously not full code)- but how do I make it now exclu...
Find elsewhere
🌐
Buck
buck.build › function › glob.html
glob() - Buck
glob(['**/*Test.java', 'StringTests.java']) All the regular files under the current directory that end in Test.java, except for HaltingProblemTest.java: glob(['**/*Test.java'], exclude = ['HaltingProblemTest.java']) All the regular .java files under the current directory, except for those that end in Test.java: glob(['**/*.java'], exclude = ['**/*Test.java'])
🌐
Feldroy
daniel.feldroy.com › posts › til-2023-09-ignoring-with-glob
TIL: Finding and ignoring files with Glob
Glob is a really handy tool for finding filepaths. It resembles regular expressions but the syntax is different. Finding matches is easy: # finds python files in the current working directory *.py # finds all the nested python files. **/*.py · What I didn't know until today is how to exclude files.
🌐
Reddit
reddit.com › r/commandline › bash glob to exclude substring
r/commandline on Reddit: bash glob to exclude substring
August 30, 2024 -

I have a directory with backups. Each file increments by day of month from 01 to 31. I want to delete all of the files except the 01 file. Of course I can do this with multiple commands, but it seems like there should be a one line solution. I'm looking for the equivalent of:

rm 0[2-9]; rm [1,2,3]?

edit: I'm interested in the globbing or file expansion solution.

🌐
DeepSource
deepsource.com › blog › glob-file-patterns
Tips for writing glob patterns in DeepSource configuration • DeepSource
In addition to matching filenames, globs are also used for matching arbitrary strings (wildcard matching) like? which matches a single character. But since, we are focussing on writing test-file and exclude-file patterns we will be focussing on wildcards such as *, ** and / that are widely used for writing glob patterns for matching files in a project.
🌐
YouTube
youtube.com › watch
PYTHON : glob exclude pattern - YouTube
PYTHON : glob exclude pattern [ Gift : Animated Search Engine : https://www.hows.tech/p/recommended.html ] PYTHON : glob exclude pattern Note: The informati
Published: December 5, 2021
🌐
Blackwell Systems
blog.blackwell-systems.com › posts › glob patterns: complete syntax reference with examples
Glob Patterns: Complete Syntax Reference with Examples | Blackwell Systems
December 27, 2025 - The shell expands {a,b} first, then applies glob patterns to each result. Available in bash (with shopt -s extglob) and zsh (enabled by default). ... Available by default in zsh. Different shells have different defaults for matching dotfiles (files starting with .). ... # Matches hidden files explicitly .* # Exclude .
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › core › extensions › file-globbing
File globbing - .NET | Microsoft Learn
June 24, 2025 - When using any of the Match overloads, there is no file system I/O involved. All of the file globbing is done in memory with the include and exclude patterns of the matcher instance. The parameters of the Match overloads do not have to be fully qualified paths.
🌐
Ergoithz
ergoithz.github.io › browsepy › exclude.html
Excluding paths — browsepy 0.5.6 documentation
Starting from version 0.5.3, browsepy accepts –exclude command line arguments expecting linux filename expansion strings, also known as globs.
🌐
YouTube
youtube.com › the python oracle
glob exclude pattern - YouTube
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn--Music by Eric Matyashttps://www.soundimage.orgTrack title: City Ben
Published: March 26, 2023
Views: 55