[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fwd: Re: Rename directory]

From: Ted Stern
Subject: Re: [Fwd: Re: Rename directory]
Date: Mon, 12 Dec 2005 11:48:53 -0800
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

On 12 Dec 2005 at 06:54 UTC-0800, Todd Denniston wrote:
> However the user should be aware of one place where the exec works
> better than xargs.  If someone has been allowed to put space(s) in
> file names or directory names, xargs will fail for those entries,
> where -exec would work.

That is what the -i argument of xargs is intended for; see below.  You
just have to make sure that xargs quotes the filenames.

> The wisdom of allowing spaces in file names or directory names has
> already been discussed, check the list archive if you want to see
> that flame fest. (of which I was a part.)
>> Use
>> find with the -print, then pass the results to xargs to run the
>> command on a bunch of things at once.  For example:
>>      find <dirname> -print | xargs cvs add

If you have files with spaces, use instead

   find <dirname> -print | xargs -i@ cvs add "@"

>> If your find command doesn't print the directories before the files,
>> add the directories first.
>>      find <dirname> -type d -print | xargs cvs add
>>      find <dirname> -type f -print | xargs cvs add

      find <dirname> -type d -print | xargs -i@ cvs add "@"
      find <dirname> -type f -print | xargs -i@ cvs add "@"

If you have '@' characters in your file names, use -i'{}' or some
other substitution instead.

 dodecatheon at gmail dot com
 Frango ut patefaciam -- I break so that I may reveal

reply via email to

[Prev in Thread] Current Thread [Next in Thread]