You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context
I want to list all files recursively in a directory while printing only the basename.
So instead of this:
dir1\test1.txt
dir1\test2.txt
dir2\testA.txt
I want this:
test1.txt
test2.txt
testA.txt
To my understanding, the best way to do so is to use fd -t f -x echo {/}.
On windows cmd.exe it works fine (but it's very slow).
fd -t f -x echo {/}
test1.txt
test2.txt
testA.txt
On windows powershell.exe, the output is not as expected.
$ fd -t f -x echo {/}
-encodedCommand LwA= -inputFormat xml -outputFormat text dir1\test1.txt
-encodedCommand LwA= -inputFormat xml -outputFormat text dir1\test2.txt
-encodedCommand LwA= -inputFormat xml -outputFormat text dir2\testA.txt
Question
Is this a bug?
Maybe a documentation problem?
Is there a better way than fd -t f -x echo {/} ?
The text was updated successfully, but these errors were encountered:
I don't think so. You need to properly escape {} characters. Please see #646, #722, #310 for more details.
Maybe a documentation problem?
Possibly. It's not really fds fault. {} always need to be escaped in PowerShell. But we could maybe make sure that all examples use a syntax that would also work in PowerShell and mention it in the troubleshooting section here: https://github.com/sharkdp/fd#troubleshooting
Is there a better way than fd -t f -x echo {/} ?
Not really. Alternatively, you could use -x basename, if that's available on Windows.
What version of
fd
are you using?Context
I want to list all files recursively in a directory while printing only the basename.
So instead of this:
I want this:
To my understanding, the best way to do so is to use
fd -t f -x echo {/}
.On windows
cmd.exe
it works fine (but it's very slow).fd -t f -x echo {/} test1.txt test2.txt testA.txt
On windows
powershell.exe
, the output is not as expected.Question
Is this a bug?
Maybe a documentation problem?
Is there a better way than
fd -t f -x echo {/}
?The text was updated successfully, but these errors were encountered: