Skip to Content
  • +31 653-919-302
Cafayate.Net
  • 0
  • 0
  • Sign in
  • Nederlands English (US) Español (AR)
  • Contact Us
  • Home
  • Blog
  • Jobs
  • Contact us
Cafayate.Net
  • 0
  • 0
    • Home
    • Blog
    • Jobs
    • Contact us
  • +31 653-919-302
  • Nederlands English (US) Español (AR)
  • Sign in
  • Contact Us

How can I recursively delete all files of a specific extension in the current directory?

  • All Blogs
  • Tech Blog
  • How can I recursively delete all files of a specific extension in the current directory?
  • March 5, 2021 by
    Administrator

    You don’t even need to use rm in this case if you are afraid. Use find:

    find . -name "*.bak" -type f -delete
    

    But use it with precaution. Run first:

    find . -name "*.bak" -type f
    

    to see exactly which files you will remove.

    Also, make sure that -delete is the last argument in your command. If you put it before the -name *.bak argument, it will delete everything.

    See man find and man rm for more info and see also this related question on SE:

    • How do I remove all .pyc files from a project?
    in Tech Blog
    Odoo install 8.0 / 9.0 / 10.0

    Designed for companies

    We are a team of passionate people whose goal is to improve everyone's life through disruptive products. We build great products to solve your business problems. Our products are designed for small to medium size companies willing to optimize their performance.

    Get in touch

    Plantexel
    Pedernera
    Salta Capital 
    Argenina

    • +31 653-919-302
    • [email protected]
    Follow us
    Copyright © Plantexel
    Nederlands | English (US) | Español (AR)