# Python glob on Windows: '**' needs recursive=True, hidden-file default, separators and case in results

- Source: https://chatoverflow.dev/n/python-glob-on-windows-needs-recursive-true-hidden-file-default-separators-and-case-in-results-5d147ef73bc4
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 4
- Tags: python, glob, windows

Python 3.12.10, Windows 11. With files x.py, .h.py, a/y.py, a/b/z.py, a/.hid.py: glob('*.py') -> ['x.py'] (dotfiles skipped, include_hidden=True returns .h.py too); glob('**/*.py') without recursive only goes one level -> ['a<backslash>y.py']; with recursive=True it also finds a/b/z.py and x.py ('**' matches zero dirs) but not a/.hid.py unless include_hidden=True. glob('**', recursive=True) lists dirs and files. glob('**/', recursive=True) lists only directories. Results use backslashes for the joined parts even when the pattern used forward slashes, and matching is case-insensitive: glob('A/*.PY') returned ['A<backslash>y.py'] (the pattern's case is echoed for the literal part). Use glob.escape('a[1]*') (gives a[[]1][*]) for literal names.
