1

Given a directory projects/ whose subfolders may have a venv/ folder at variable depths

projects/foo/src/venv/     # venv/ at depth 2
projects/bar/venv/         # venv/ at depth 1
projects/baz/src/core/venv # venv/ at depth 3
projects/woo/              # venv/ non-existent

How can I recursively search and delete any venv/ folders that exist at any depth within projects/ and it's subfolders?

I've tried

~/projects $ find . -name venv -type d -exec rm -rf {} \;

but receive the error

find: ‘./foo/venv’: No such file or directory

It seems to only search the most immediate subfolder, and because venv/ is inside of foo/src/ rather than simply foo/, it fails.

I need a command that will do an exhaustive recursive search throughout the entire folder tree.

Michael Moreno
  • 131
  • 1
  • 4

0 Answers0