< BACK TO BLOG

remove node_modules from all subdirectories

Published Sat Jul 31 2021



Windows
cmd.exe /c "@for /d /r . %d in (node_modules) do @if exist %d (echo %d && rd %d /s /q)"

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

ref: https://stackoverflow.com/questions/42950501/delete-node-modules-folder-recursively-from-a-specified-path-using-command-line





Subscribe to my Newsletter

Get the latest posts delivered right to your inbox