Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Apr 2008 16:39:23 -0700
From:      Bill Campbell <freebsd@celestial.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: file/directory names with space in between
Message-ID:  <20080414233923.GA25385@ayn.mi.celestial.com>
In-Reply-To: <4803E7D4.7080003@schrodinger.com>
References:  <4803E7D4.7080003@schrodinger.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 something -print0 | xargs -0 command

Bill
-- 
INTERNET:   bill@celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186

The ultimate result of shielding men from the effects of folly is to fill
the world with fools. -- Herbert Spencer (1891)



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