Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Apr 2008 04:05:47 +0100
From:      RW <fbsd06@mlists.homeunix.com>
To:        freebsd-questions@freebsd.org
Cc:        freebsd@celestial.com
Subject:   Re: file/directory names with space in between
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>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 14 Apr 2008 16:39:23 -0700
Bill Campbell <freebsd@celestial.com> 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.



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