fd icon indicating copy to clipboard operation
fd copied to clipboard

--exclude is not working

Open UnknownSuperficialNight opened this issue 2 years ago • 3 comments

What version of fd are you using? [paste the output of fd --version here]

version='fd 8.4.0'

im having issues with syntax or fd is just broken

fd --exclude "/mnt/1.9tbhdd/SteamLibrary" --exclude "/mnt/1.9tbhdd/Back In Time Snapshots" -t f -e mkv -e mp4 --search-path '/mnt/1.9tbhdd' -x bash -c 'echo {}'

the above command will search for files with the extensions .mkv and .mp4 within the directory /mnt/1.9tbhdd, while excluding the two specified directories (/mnt/1.9tbhdd/SteamLibrary and /mnt/1.9tbhdd/Back In Time Snapshots).

The bash -c 'echo {}' is just a example before anyone comments u don't need it it's just here for context

problem im having is /mnt/1.9tbhdd/SteamLibrary is still being found even with the --exclude

i tried ! -path 'Dir' instead of --exclude 'Dir' that wont work with --search-path so i tried --full-path and that does nothing just exits the program

any ideas on what im doing wrong?

UnknownSuperficialNight avatar Jun 15 '23 05:06 UnknownSuperficialNight

--exclude is relative to the starting directory, as if it's a .gitignore rule basically. So this should work:

$ fd --exclude /SteamLibrary --exclude "/Back In Time Snapshots" ... /mnt/1.9tbhdd ...

tavianator avatar Jun 15 '23 15:06 tavianator

How do you do exclude any directory matching pattern?

e.g: exclude any dir named templates? I tried fd -E '*/templates/*' but that only worked on the top level (relative) dirs and not recursive

IzhakJakov avatar May 22 '24 17:05 IzhakJakov

Just use "templates/"

tmccombs avatar May 23 '24 04:05 tmccombs