Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Nov 2002 12:47:58 -0500
From:      Rob Ellis <rob@web.ca>
To:        Matthew Bettinger <mbettinger@championelevators.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: simple find command
Message-ID:  <20021106174758.GA73328@web.ca>
In-Reply-To: <200211061124.25334.mbettinger@championelevators.com>
References:  <200211061124.25334.mbettinger@championelevators.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <rob@web.ca>
System Administrator, Web Networks

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021106174758.GA73328>