[ale] chown options
Geoffrey
esoteric at 3times25.net
Wed Jan 19 17:20:06 EST 2005
Jason Day wrote:
> On Wed, Jan 19, 2005 at 02:28:00PM -0500, Geoffrey wrote:
>
>>>>find . -print|grep -v $DIRECTORY_TO_EXCLUDE|xargs -n 10 chown foo.bar
>>>
>>>
>>>A slightly faster way:
>>>
>>>chown -R foo.bar `find . -type d -print | grep -v $DIRECTORY_TO_EXCLUDE`
>>
>>How is this faster? You're invoking three processes, I'm invoking three
>>processes. In reality, I beleive the `` syntax is actually more costly
>>then another pipe. Feel free to prove me wrong though. :)
>
>
> My way only invokes chown once. Using xargs, if I understand it
> correctly, will invoke chown N mod 10 times, where N equals the number
> of files and subdirectories in the current directory and beneath.
Right, but if the number of files is too large, which is very likely to
happen your solution won't work at all as you'll get a broken pipe.
Hence the reason I threw in the '-n 10' You could certainly jump it up
to say, 1000, but your solution will attempt to chown all the files and
likely will puke and not work at all.
>
> Also, note that I only searched for directories, and did a "chown -R
> foo.bar" on each directory, whereas you executed "chown foo.bar" on each
> file.
My follow solution used chown -R as well.
>
> And actually, now that I think about that a little more, my way won't
> work at all, unless $DIRECTORY_TO_EXCLUDE is in the current directory.
> Thinking a little more, my way will probably be slower, because the
> recursive chown will chown everything in subdirectories multiple times.
> Ack! Disregard my last post!
Not necessarily, this has been a good discussion. :)
--
Until later, Geoffrey
More information about the Ale
mailing list