From owner-freebsd-questions@FreeBSD.ORG Mon Apr 6 21:11:15 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A5811065A9E for ; Mon, 6 Apr 2009 21:11:15 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id E40378FC1F for ; Mon, 6 Apr 2009 21:11:14 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id n36LBD78094870 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 6 Apr 2009 16:11:13 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.3/8.14.3) with ESMTP id n36LBDq5035884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 6 Apr 2009 16:11:13 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.3/8.14.3/Submit) id n36LBB6s035859; Mon, 6 Apr 2009 16:11:11 -0500 (CDT) (envelope-from dan) Date: Mon, 6 Apr 2009 16:11:11 -0500 From: Dan Nelson To: John Almberg Message-ID: <20090406211111.GF70541@dan.emsphone.com> References: <5BF30BAA-2B35-46C8-8257-56B077D00A8C@identry.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5BF30BAA-2B35-46C8-8257-56B077D00A8C@identry.com> X-OS: FreeBSD 7.1-STABLE User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: ClamAV version 0.94.1, clamav-milter version 0.94.1 on email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Mon, 06 Apr 2009 16:11:13 -0500 (CDT) X-Scanned-By: MIMEDefang 2.45 Cc: freebsd-questions@freebsd.org Subject: Re: How to remove all files with a certain extension X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2009 21:11:18 -0000 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@allantgroup.com