0

I want to find directory 'node_modules' in the current directory. But I do not need nested 'node_modules'. For example, I do not need 'node_modules' in 'node_modules', only parents. When the directories are found, I want to delete them.

1

1 Answer 1

0

Check for directory exist then delete.

[ -d node_modules ] && rm -rf node_modules

You can skip checking and use only rm:

rm -rf node_modules
2
  • What does [ -d node_modules ] do? Commented Jan 16, 2017 at 12:34
  • checking if the directory exists. Commented Jan 16, 2017 at 12:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .