Re: file/directory names with space in between

2008-04-15 Thread Derek Ragona

At 06:25 PM 4/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.


What should I do to put escape key in there to include full names?

Simon


try using double quotes and wild cards where the spaces are, such as:

find / -name "interesting*story\2008*March\{story*one,story*two}"

-Derek

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: file/directory names with space in between

2008-04-14 Thread RW
On Mon, 14 Apr 2008 16:39:23 -0700
Bill Campbell <[EMAIL PROTECTED]> 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.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: file/directory names with space in between

2008-04-14 Thread Bill Campbell
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:   [EMAIL PROTECTED]  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)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: file/directory names with space in between

2008-04-14 Thread Christopher Cowart
Simon Gao wrote:
> 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.
> 
> What should I do to put escape key in there to include full names?

$ echo foo > "test 1"
$ find . -type f -exec cat {} \;
foo

Looks like it Just Works(tm), no quoting necessary. Could you provide
the actually command you're running that isn't doing what you expect?

-- 
Chris Cowart
Network Technical Lead
Network & Infrastructure Services, RSSP-IT
UC Berkeley


pgpok0Zsz3fiS.pgp
Description: PGP signature