Hacker News new | past | comments | ask | show | jobs | submit login

I would suggest

    fd -t f . cache -X rm --
Which reads as find "any file", "matching .", "in directory cache", then "execute rm -- followed by an argument list of all found files".

This ensures even if you have filenames starting with - they won't be interpreted as options for rm. For even more sanity of mind you may want to turn on -a for absolute paths, although I don't see an example right now where using relative paths would go wrong.




Yes, that looks safer. I didn't realize I could put the `-X` option at the end. The man page says:

Usage: fd [OPTIONS] [pattern] [path]...

So, I presumed the path had to go last.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: