If you use frequently the terminal under Ubuntu to delete files and want an easy method for deleting a specific file extension, then this tip might be useful for you. The command we will see consists of deleting a specific file format stored in a directory, the file extension in question will be also deleted from other sub-folders.

Using this command will surely save you a lot of time. To do this we will use the "find" command. Open the terminal and run this command:

find directory-name *.bmp -delete

Replace bmp with your own file extension you want to delete (mp3, doc, txt, wav, mp4, etc.).

The selected file extension will be removed from the parent directory and all its sub-directories, so be careful when using this command to avoid deleting necessary files.

That's it!

Post a Comment