Date: Mon, 6 Apr 2009 19:10:04 -0400 From: John Almberg <jalmberg@identry.com> To: freebsd-questions@freebsd.org Subject: Re: How to remove all files with a certain extension Message-ID: <4D0D0EC0-6547-4D04-9006-D5CE128C4DB1@identry.com> In-Reply-To: <20090406211111.GF70541@dan.emsphone.com> References: <5BF30BAA-2B35-46C8-8257-56B077D00A8C@identry.com> <20090406211111.GF70541@dan.emsphone.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Apr 6, 2009, at 5:11 PM, Dan Nelson wrote:
> 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.
Fantastic. I never noticed the -delete option before. Amazing what
you can find in a man page if you know it's there :-)
Thanks: John
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D0D0EC0-6547-4D04-9006-D5CE128C4DB1>
