Skip to main content
  1. How To/

Find Files And Delete Recursively

·89 words·1 min
Ravi Singh
Author
Ravi Singh
Software engineer with 15+ years building backend systems and cloud platforms across fintech, automotive, and academia. I write about the things I build, debug, and learn — so I don’t forget them.
Table of Contents

Problem
#

Sometimes when using monorepos to host multiple services in a single repository, there may be a requirement to delete a file or list of files from each microservice. For example, I needed to delete application-dev.yml files for all the services after getting rid of dev environment in favor of acceptance.

Solution
#

Use following find command to find application-dev.yml files recursively and delete them.

find . -name "application-dev.yml" -type f -delete

we may also use glob filters while using find:

find . -name "application-d*.yml" -type f -delete

Discussion