From owner-freebsd-questions@FreeBSD.ORG Mon Apr 14 23:39:24 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 04AD91065717 for ; Mon, 14 Apr 2008 23:39:24 +0000 (UTC) (envelope-from bill@ayn.mi.celestial.com) Received: from ayn.mi.celestial.com (hayek.celestial.com [192.136.111.12]) by mx1.freebsd.org (Postfix) with ESMTP id D82538FC16 for ; Mon, 14 Apr 2008 23:39:23 +0000 (UTC) (envelope-from bill@ayn.mi.celestial.com) Received: from localhost (localhost [127.0.0.1]) by ayn.mi.celestial.com (Postfix) with ESMTP id 6020768038C96; Mon, 14 Apr 2008 16:39:23 -0700 (PDT) X-Virus-Scanned: amavisd-new at mi.celestial.com Received: from ayn.mi.celestial.com ([127.0.0.1]) by localhost (ayn.mi.celestial.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 6185SD+CbVoQ; Mon, 14 Apr 2008 16:39:23 -0700 (PDT) Received: by ayn.mi.celestial.com (Postfix, from userid 203) id 3ACE368038C8F; Mon, 14 Apr 2008 16:39:23 -0700 (PDT) Date: Mon, 14 Apr 2008 16:39:23 -0700 From: Bill Campbell To: freebsd-questions@freebsd.org Message-ID: <20080414233923.GA25385@ayn.mi.celestial.com> Mail-Followup-To: freebsd-questions@freebsd.org References: <4803E7D4.7080003@schrodinger.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4803E7D4.7080003@schrodinger.com> User-Agent: Mutt/1.5.11 OpenPKG/2.5 Subject: Re: file/directory names with space in between X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd@celestial.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Apr 2008 23:39:24 -0000 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)