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

Re: [SAGE] LDAP Migration Question



On Sat, 2007-06-30 at 01:00 -0500, Brad Knowles wrote:
> On 6/29/07, David Magda quoted Chris St. Pierre:
> 
> >>  find / -owner $old_uid | xargs chown $2
> >
> >  Be careful with paths with spaces with this line.
> 
> Indeed.
> 
> >  Depending on the version of find(1) that is being used it may be desirable
> >  to use the "-exec" option instead of xargs(1).
> 
> Personally, I'd recommend using the "-print0" argument to find, and 
> the "-0" argument to xargs.  That works pretty reliably for me, and 
> avoids unnecessary large numbers of single-instance exec calls where 
> a smaller number of xargs calls can be done.
> 

If your find is POSIX conforming, then you can do

find / -owner $old_uid -exec chown $2 {} +

and this is the same as the xargs with the -print0 and -0, and more
portable! It does NOT do unnecessary large numbers of single-instance
exec calls! Note that the last argument is "+" and not "\;" ...

Note that GNU findutils has supported this for over two years.

-- 
Nick Stoughton                          Cell: 510 388 1413
USENIX Standards Liaison                Fax:  510 548 5738