From owner-freebsd-questions Wed Nov 6 9:48:13 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D87CF37B401 for ; Wed, 6 Nov 2002 09:48:12 -0800 (PST) Received: from spin.web.net (spin.web.net [192.139.37.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2BC6D43E75 for ; Wed, 6 Nov 2002 09:48:12 -0800 (PST) (envelope-from rob@web.net) Received: by spin.web.net (Postfix, from userid 1000) id C053312E470; Wed, 6 Nov 2002 12:47:58 -0500 (EST) Date: Wed, 6 Nov 2002 12:47:58 -0500 From: Rob Ellis To: Matthew Bettinger Cc: freebsd-questions@freebsd.org Subject: Re: simple find command Message-ID: <20021106174758.GA73328@web.ca> Mail-Followup-To: Rob Ellis , Matthew Bettinger , freebsd-questions@freebsd.org References: <200211061124.25334.mbettinger@championelevators.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200211061124.25334.mbettinger@championelevators.com> User-Agent: Mutt/1.3.28i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Nov 06, 2002 at 11:24:19AM -0600, Matthew Bettinger wrote: > I am having a bit of trouble with the find command. I am a novice in its use > so maybe someone can help me out here. > > I have a list of files (hundreds) in directory . and need to search through > and delete every file that contains the word foo. > try find . -name "*foo*" -print0 | xargs -0 rm the -print0/-0 handles the filenames as null-terminated strings, so filenames with spaces, etc. are handled correctly. - rob -- Rob Ellis System Administrator, Web Networks To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message