fd icon indicating copy to clipboard operation
fd copied to clipboard

Option to only show ignored files

Open JoelCourtney opened this issue 4 years ago • 2 comments

It would be helpful to me to have an option to invert the rule to exclude files in gitignore. Maybe -O and --only-ignore?

For example, my particular use case is that I would like to run fd -O -e json -X rm.

JoelCourtney avatar Mar 14 '22 21:03 JoelCourtney

I think this would probably require a change to the upstream ignore crate that fd uses, to support inverting the ignore logic.

tmccombs avatar Mar 15 '22 07:03 tmccombs

I have the following alias in my .gitconfig:

[alias]
  lsignored = ls-files . --ignored --exclude-standard --others
  # …

and I use the quite often. This could also help with your use case, if you do something like (untested):

git lsignored | grep '\.json$' | xargs rm

sharkdp avatar Mar 18 '22 20:03 sharkdp