[ale] chown options

Jason Day jasonday at worldnet.att.net
Wed Jan 19 16:13:48 EST 2005


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.

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.

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!

Jason
-- 
Jason Day                                       jasonday at
http://jasonday.home.att.net                    worldnet dot att dot net
 
"Of course I'm paranoid, everyone is trying to kill me."
    -- Weyoun-6, Star Trek: Deep Space 9



More information about the Ale mailing list