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
Add a -Force switch to Convert-Path and Resolve-Path so as to also support hidden files.
#20929
Comments
|
This sounds like a great enhancement 👍 It was always interesting how only Makes sense to use |
|
I noticed as well on Ubuntu this seems to only be an issue with wildcards: 12-21 18:37:36 ~/git-repos/PowerShell [master ≡]> Convert-Path ./.gitignore
/home/armaan/git-repos/PowerShell/.gitignore
12-21 18:37:52 ~/git-repos/PowerShell [master ≡]> Convert-Path ./.git*
12-21 18:37:55 ~/git-repos/PowerShell [master ≡]>
12-21 18:37:55 ~/git-repos/PowerShell [master ≡]> Resolve-Path ./.gitignore
Path
----
/home/jdoe/git-repos/PowerShell/.gitignore
12-21 18:40:39 ~/git-repos/PowerShell [master ≡]> Resolve-Path ./.git*
12-21 18:40:42 ~/git-repos/PowerShell [master ≡]>On Windows it works as expected: 12-21 18:39:15 ~\git-repos\PowerShell [master ≡]> Convert-Path .\.gitignore
C:\Users\jdoe\git-repos\PowerShell\.gitignore
12-21 18:39:20 ~\git-repos\PowerShell [master ≡]> Convert-Path .\.git*
C:\Users\jdoe\git-repos\PowerShell\.github
C:\Users\jdoe\git-repos\PowerShell\.gitattributes
C:\Users\jdoe\git-repos\PowerShell\.gitignore
12-21 18:39:23 ~\git-repos\PowerShell [master ≡]> Resolve-Path .\.gitignore
Path
----
C:\Users\jdoe\git-repos\PowerShell\.gitignore
12-21 18:40:05 ~\git-repos\PowerShell [master ≡]> Resolve-Path .\.git*
Path
----
C:\Users\jdoe\git-repos\PowerShell\.github
C:\Users\jdoe\git-repos\PowerShell\.gitattributes
C:\Users\jdoe\git-repos\PowerShell\.gitignore |
|
Thanks, @ArmaanMcleod. Good point about only wildcard expressions being affected (I've updated the initial post to clarify.) Note that As an aside:
|
|
I forgot that years ago I had asked for the same, only more comprehensively:
|


Summary of the new feature / enhancement
Currently, both
Convert-PathandResolve-Pathonly ever report non-hidden files as matching a given wildcard pattern.In order to also support hidden files, a
-Forceswitch should be added, analogous toGet-ItemandGet-ChildItem.E.g., on Unix-like platforms:
This currently produces NO output, because
.-prefixed files and directories are considered hidden on Unix-like platforms.Desired output (for example):
Note: The problem arises only with wildcard patterns - literal paths are found.
Proposed technical implementation details (optional)
No response
The text was updated successfully, but these errors were encountered: