Reputation: 759
After connecting to a network share on OS X I am looking to delete all files that have a particular extension (filename.exte for example) from all folders within the share. If i'm in the very top folder is there a command in terminal I can run that will do this?
If this it not possible, is there any other way to achieve this?
Upvotes: 0
Views: 155
Reputation: 212949
You can use find
:
$ find /Volumes/whatever -type f -name \*.exte -exec rm -f {} \;
However you need to be very careful - one slip and you could delete a lot of files uninintentionally - I usually do a "dry run" first:
$ find /Volumes/whatever -type f -name \*.exte -exec echo "rm -f {}" \;
(this will just list the files that would be deleted with the first version, but will not actually delete anything).
Upvotes: 1