file/directory names with space in between

Bill Campbell freebsd at celestial.com
Mon Apr 14 23:39:24 UTC 2008


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 at 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)


More information about the freebsd-questions mailing list