How to remove all files with a certain extension
Dan Nelson
dnelson at allantgroup.com
Mon Apr 6 14:11:18 PDT 2009
In the last episode (Apr 06), John Almberg said:
> This is a real newbie question, but I can't figure it out...
>
> I want to remove all .tar files from a directory tree. I think something
> like the following should work, but I must have something wrong, because
> it doesn't:
>
> find . -name *.tar -exec rm /dev/null {} \;
find . -name "*.tar" -delete
Make sure you quote your wildcards so the shell doesn't expand them, and use
the -delete primary to save a fork/exec for each filename.
--
Dan Nelson
dnelson at allantgroup.com
More information about the freebsd-questions
mailing list