Tuesday, August 1, 2017

Delete all files of a specific extension from the directory that is executed, and all it's subfolders - Ubuntu - OSX

The following commands will affect all files of the specified extension from the directory that is executed, and all it's subfolders. It should work on all UNIX based operating systems:

Execute this command first in order to display all the files that are to be deleted (replace EXT with the desired extension):
find . -name "*.EXT" -type f
Executing this command will delete the list of files that the previous command returned (replace EXT with the desired extension):
find . -name "*.EXT" -type f -delete

No comments:

Post a Comment