classification
Title: Change Glob: Allow Recursion for Hidden Files
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: k64, myungsekyo, petr.viktorin, serhiy.storchaka, ys19991
Priority: normal Keywords:

Created on 2019-07-13 02:23 by k64, last changed 2021-04-22 14:29 by petr.viktorin.

Messages (4)
msg347767 - (view) Author: Kalev Maricq (k64) Date: 2019-07-13 02:23
First, sorry if this isn't in the correct place or correctly labeled. I'm new to this platform.  Feel free to edit this (if that's even possible on this platform). 

In the glob.py module, _ishidden(pattern) is used to determine whether to show hidden files and folders by checking if pattern[0]=='.'.  It also uses _isrecursive(pattern) to determine whether to perform a recursive search by checking whether the pattern=='**'.  As a result, one cannot perform a recursive search which shows hidden folders and files, since '**'[0]!='.'.  

Suggestion: Alter _isrecursive to return '**' in pattern to allow for this.
msg347811 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-07-13 13:08
This is an interesting question. What other implementations behave?
msg373441 - (view) Author: Wansoo Kim (ys19991) * Date: 2020-07-10 06:38
Can you reproduce this bug? I was able to find the hidden file by recursive search by excuting the code below.

```
from glob import glob

hidden = glob('**/.*')

print(hidden)
```
msg391603 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-04-22 14:29
I wonder if it would be worth it to add a new option to include hidden files (except . and ..)
For the record, setuptools' fork of glob does this unconditionally: https://github.com/pypa/setuptools/blob/main/setuptools/glob.py
History
Date User Action Args
2021-04-22 14:29:42petr.viktorinsetnosy: + petr.viktorin
messages: + msg391603
2020-07-10 06:38:12ys19991setnosy: + ys19991
messages: + msg373441
2019-07-17 08:58:59myungsekyosetnosy: + myungsekyo
2019-07-13 13:08:53serhiy.storchakasetmessages: + msg347811
2019-07-13 05:56:58xtreaksetnosy: + serhiy.storchaka

components: + Library (Lib)
versions: + Python 3.9
2019-07-13 02:23:53k64create