To delete folders one by one and printing the folder being deleted, use the below terminal command: find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' ;