Repository navigation
Description
Describe the bug
Copying from Discord:
Found another issue. + simple but verbose workaround:
glob C:\some\folder\path/to/another/folder/*.zip
doesn't work. glob doesn't seem to like the C: and \ on Windows machines. However, this does work:
glob /C/some/folder/path/to/another/folder/*.zip
This error gets easily encountered when using environment variables that expand to C:\ such as $env.PWD.
glob $"($env.PWD)/to/another/folder/*.zip"
Workaround:
glob $"($env.PWD | str trim --left --char 'C' | str trim --left --char ':' | str replace --all "\\" "/")/to/another/folder/*.zip"
This one was simple enough to reproduce and describe so I'll go open a github issue for it now
How to reproduce
- Be on windows device
- run
glob $"($env.PWD)/to/another/folder/*.zip - See that you get an error about being unable to parse the path
Expected behavior
glob should support paths in windows format C:\path\to\folder\*.zip
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.92.2 |
| branch | |
| commit_hash | 2a08a18 |
| build_os | windows-x86_64 |
| build_target | x86_64-pc-windows-msvc |
| rust_version | rustc 1.77.2 (25ef9e3d8 2024-04-09) |
| rust_channel | 1.77.2-x86_64-pc-windows-msvc |
| cargo_version | cargo 1.77.2 (e52e36006 2024-03-26) |
| build_time | 2024-04-10 21:24:51 +00:00 |
| build_rust_channel | release |
| allocator | mimalloc |
| features | default, sqlite, trash, which |
| installed_plugins |
Additional context
Thanks for the awesome tool! :)
Edit:
As pointed out by @sholderbach here, I posted the wrong version info. I reproduced this issue on my windows machine but submitted the issue report from my Linux machine. I'll correct this with the proper version info when I get around to booting up my Windows machine.
Edit:
The table / version info has been updated :)
Activity
sholderbach commentedon Jul 11, 2024
Do I see it correctly based on your
versionoutput that you are running on Linux but working on Windows paths there? I think we have several places where we make the assumption that you would only work with the system specific path separation rules (e.g.path split) could be that this is also true forglobTCROC commentedon Jul 11, 2024
@sholderbach that is a mistake. I reproduced on my windows machine but submitted the bug from my linux machine. Hence I grabbed incorrect version info. But the error report still stands. I'll edit the original issue.
TCROC commentedon Jul 11, 2024
Thank you for catching that! :)
sholderbach commentedon Jul 11, 2024
Ah OK, had hoped for one of those weird ones. Sounds like we need to get the basics right first :D
TCROC commentedon Jul 11, 2024
@sholderbach I updated the version info :) Thanks again! :)
a-usr commentedon May 15, 2026
For anyone looking at this, nushell now treats drive letters correctly in globs, but backwards-facing slashes still have to be replaced with forward-facing ones:
kronberger-droid commentedon Nov 14, 2026
The current
globis being replaced by thedc-globbackend, which is tracked in #18101.Backslashes as separators in patterns are part of that.