file/directory names with space in between

RW fbsd06 at
Tue Apr 15 03:35:20 UTC 2008

On Mon, 14 Apr 2008 16:39:23 -0700
Bill Campbell <freebsd at> 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.

More information about the freebsd-questions mailing list