-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Glob: Allow Recursion for Hidden Files #81759
Comments
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. |
This is an interesting question. What other implementations behave? |
Can you reproduce this bug? I was able to find the hidden file by recursive search by excuting the code below.
|
I wonder if it would be worth it to add a new option to include hidden files (except . and ..) |
Zsh allows use of *, ? and ** to match hidden files and directories. Bash allows the same for * and ? with By the way setting options in bash is done with I've put up a PR that enables behavior similar to Zsh and Bash (at least for ? and * chars). |
If this was to be done, you'd want to make sure character sequences also match hidden files: [.]. Just * and ? would be incomplete. If allowing ** to match a leading dot, it would not match . or .. |
Isaac: my PR does allow [.] to match. But I probably need to update the docs to note that. |
I want to clarify my first comment: my PR is similar to Zsh behaviour as described above; as I'm not 100% sure how bash behaves with |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: