Easily delete files recursively matching a pattern on a Mac

Posted on 5/5/2016 @ 12:50 AM in #Apple by | Feedback | 1141 views

I find myself doing this a lot, so writing out the command for this. Basically, in a complex, super nested AngularJS2 project using TypeScript, before I save my work, I want to delete all the .js and .js.map files – recursively through all folders.
In usual dev gitignore removes them for me .. but what if I really want them gone from my disk?

In terminal, run these two commands-

   1:  find . -regex '.*\.js' -exec rm {} \+
   2:  find . -regex '.*\.js.map' -exec rm {} \+

enjoy!

Sound off but keep it civil:

Older comments..