Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

bash, delete all files with a pattern name

  • I need to delete all files with a pattern name:  2020*.js
  • Inside a specific directory: server/db/migrations/
  • And then show what it have been deleted: `| xargs“

I’m trying this:

find . -name 'server/db/migrations/2020*.js' #-delete | xargs

But nothing is deleted, and shows nothing.

What I’m doing wrong?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You’re looking for something like this:

find server/db/migrations -type f -name '2020*.js' -delete -print
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading