Thursday 27 December 2018

One-liner to delete node_modules recursively

I found myself with a ton of old abandoned projects, and their node_modules folders were eating up a significant amount of disk space.​To clear all node_modules folders from current folder recursively:find . -name "node_modules" -type d -prune -exec rm -vrf '{}' +​To ignore a specific subfolder:find . -name "node_modules" -type d -prune -not -path "./folder-to-ignore/node_modules" -exec rm -vrf '{}' +

Submitted December 28, 2018 at 12:40AM by FatherCarbon

No comments:

Post a Comment