Output base dir content without `./` prefix when multiple search paths are used
Author: goodovCreated Aug 30, 2026Updated Aug 30, 2026
Labelsquestion
What version of fd are you using?
fd 10.5.0
Is it possible to have a fd call to return non-./-prefixed paths when "." and other search paths are passed?
Here's a minimal reproduce to highlight the problem:
mkdir -p a/b/c
touch a/fileA a/b/fileB a/b/c/fileC
fd -C a --type f --exclude b --search-path=. --search-path=b/cresult:
./fileA
b/c/fileCI want all entries to be outputted without ./, so the desired result is:
fileA
b/c/fileCbut I can't pass empty search path to make this happen. If any of those can return the desired result, I'll be happy:
# allow empty search path
fd -C a --type f --exclude b --search-path= --search-path=b/c
# make --strip-cwd-prefix not fail when search paths are used
fd -C a --type f --exclude b --strip-cwd-prefix --search-path=. --search-path=b/c
# introduce a new flag to search in the base directory
fd -C a --type f --exclude b --search-base-directory --search-path=b/cWhy this feels like a bug/overlook: such call does not prepend ./:
fd -C a --type f --exclude bbut as soon as you list any search path, you're also forced to list "." as the search path:
fd -C a --type f --exclude b --search-path=. --search-path=b/cand the way git ignores are applied, it requires the first search to point to the right directory (usually ".").
Any advice to make this work?
Thanks for the great tool!
Source: sharkdp/fd