Delete node_modules folder recursively from a specified path using command line

Print out a list of directories to be deleted:

find . -name 'node_modules' -type d -prune

Delete directories from the current working directory:

find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +

Alternatively you can use trash (brew install trash) for staged deletion:

find . -name node_modules -type d -prune -exec trash {} +

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)