Home  »  CodeGuidesSnippetsTechnology   »   Recursively Delete all Files by Extension (File Type) Command

Recursively Delete all Files by Extension (File Type) Command

Posted: October 13, 2022 | by Michael Bright

Use this to recursively delete all files with a specific extension (file type) in the current directory and sub-directories.

$ find . -name "*.ext" -type f -delete

Use this command to do a dry run by listing all the files.

$ find . -name "*.ext" -type f

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.