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