sharkdp / fd

A simple, fast and user-friendly alternative to 'find'
Apache License 2.0
34.25k stars 816 forks source link

exclude and absolute path as argument #1577

Open Germano0 opened 5 months ago

Germano0 commented 5 months ago

Hello, I have noticed that --exclude flag does not accept an absolute path as argument. Indeed

both commmands

$ pwd
/home/user
fd --hidden --exclude /home/user/beta kate
fd --hidden --exclude=/home/user/beta kate

were still searching /home/user/beta. I have noticed that because such path is a SSHFS remote mount and I could notice activity on such path. To make sure fd was not searching inside such path I had to use the relative name

fd --hidden --exclude beta kate
fd --hidden --exclude=beta kate

I think it would be nice to be able to use absolute path too. Thank your for your work on fd and have a nice day

l-armstrong commented 4 months ago

I'm new to the project, and would like to work on this feature request if it's still open.

tmccombs commented 4 months ago

So the patrern passed to --exclude is interpreted similar to a gitignore pattern. That means that if it starts with a "/", then it is relative to the root search path.

So to support this, we would probably need a new option.