From owner-freebsd-questions@FreeBSD.ORG Tue Apr 15 03:35:20 2008 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 40BB91065784 for ; Tue, 15 Apr 2008 03:35:20 +0000 (UTC) (envelope-from fbsd06+VA=8626fcdb@mlists.homeunix.com) Received: from turtle-out.mxes.net (turtle-out.mxes.net [216.86.168.191]) by mx1.freebsd.org (Postfix) with ESMTP id 135AB8FC1C for ; Tue, 15 Apr 2008 03:35:19 +0000 (UTC) (envelope-from fbsd06+VA=8626fcdb@mlists.homeunix.com) Received: from mxout-04.mxes.net (mxout-04.mxes.net [216.86.168.179]) by turtle-in.mxes.net (Postfix) with ESMTP id 961DE16429B for ; Mon, 14 Apr 2008 23:05:51 -0400 (EDT) Received: from gumby.homeunix.com. (unknown [87.81.140.128]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTP id 924B5D05A7; Mon, 14 Apr 2008 23:05:49 -0400 (EDT) Date: Tue, 15 Apr 2008 04:05:47 +0100 From: RW To: freebsd-questions@freebsd.org Message-ID: <20080415040547.5768784b@gumby.homeunix.com.> In-Reply-To: <20080414233923.GA25385@ayn.mi.celestial.com> References: <4803E7D4.7080003@schrodinger.com> <20080414233923.GA25385@ayn.mi.celestial.com> X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.9; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd@celestial.com Subject: Re: file/directory names with space in between 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: Tue, 15 Apr 2008 03:35:20 -0000 On Mon, 14 Apr 2008 16:39:23 -0700 Bill Campbell wrote: > On Mon, Apr 14, 2008, Simon Gao wrote: > >Hi, > > > >I need to work on some files and directories that have spaces in > >them like: > > > >interesting story\2008 March\{story one,story two}. > > > >When using find with -exec, part of the file/directory name will be > >missing and therefore lead to error. > > Generally it's better to use find and xargs when processing > arbitrary lists of files. It can be significantly more efficient > than ``exec'ing'' a command for each file when the command can > process multiple arguments, and they previde for file names with > strange characters using the -print0 option to find, and -0 > option to xargs as in: find has neither of the limitations you mention. It does the equivalent of "-print0 | xargs -0" automatically, and can handle multiple arguments with "{} +". It also has -execdir which can be convenient.