fd
fd copied to clipboard
In MSYS, `fd --glob` fails whenever a path separator is present
So here's the directory I'm messing about with
Pictures/Backgrounds/1.jpg
Pictures/Backgrounds/2.jpg
Pictures/Backgrounds/3.jpg
Pictures/1.jpg
And here's some results:
λ fd -u -g 'Pictures'
Pictures/
λ fd -u -g 'Backgrounds'
Pictures/Backgrounds/
λ fd -u -g '1*'
Pictures/1.jpg
Pictures/Backgrounds/1.jpg
λ fd -u -g 'Pictures/1*'
(Nothing)
λ fd -u -g 'Pictures/1.jpg'
(Nothing)
λ fd -u -g 'Pictures/Backgrounds'
(Nothing)
λ fd -u -g 'Pictures/Backgrounds/*'
(Nothing)
λ fd -u -g 'Pictures/**'
(Nothing)
λ fd -u -g '*/*'
(Nothing)
(I then went through and tried all of the failing commands above with \
, \\
, and \/
, all had the same result)
So as you can kind of see, whenever there's a path separator, fd just never returns anything. This also happens when using --full-path
, with and without **/
prefixed.
EDIT: Okay, realised I was missing some info. Although I'm running in MSYS, the fd executable is the Windows release available via scoop.sh, which I believe is the msvc version. So, I tried this in Windows PowerShell, found the exact same result, and then tried in Windows CMD, and the glob option didn't do anything at all (which is probably a separate issue). I also downloaded and tested using the gnu version, and the result is the same.
I think you need to use both --full-path and use the correct path separator ("").
As mentioned I tried with and without --full-path
and with every kind of path separator I could think of. I also have tried setting --path-separator
and that makes no difference.
I believe the solution here is you need the full ABSOLUTE path, not the "full path". The command name by itself suggests to me the full relative path (which is not an option unfortunately).
-p, --full-path Search full abs. path (default: filename only)
mcmah309@DESKTOP-CVL0FVG:/mnt/c/Work/obelisk$ fd -g test
test/
lib/src/obelisk_document/data/building/post_processing/test/
mcmah309@DESKTOP-CVL0FVG:/mnt/c/Work/obelisk$ fd -g lib/**/test
mcmah309@DESKTOP-CVL0FVG:/mnt/c/Work/obelisk$ fd -g **/lib/**/test
mcmah309@DESKTOP-CVL0FVG:/mnt/c/Work/obelisk$ fd -gp lib/**/test
mcmah309@DESKTOP-CVL0FVG:/mnt/c/Work/obelisk$ fd -gp **/lib/**/test
lib/src/obelisk_document/data/building/post_processing/test/