chown thru multiple directories

John D Mccalpin mccalpin at vax1.acs.udel.EDU
Wed Jul 11 00:18:40 AEST 1990


JORDAN%gmr.com at relay.cs.net asks about "chown thru multiple directories"
>>Is there a command available that will change the owner and group
>>of every file in the current directory, and every file & directory
>>below the current directory?

In article <see above> karron at MCIRPS2.MED.NYU.EDU writes:
>
>find /$startdir -exec chown $username "{}" \; -print
>
>karron at nyu.edu                          Dan Karron

Although this is not an SGI-specific issue, I would like to point
out that this approach can be *very* slow for large directory trees
since the 'find' program forks off a 'chown' program for each file
that it finds.

A much more efficient approach is to use xargs:

	find . -print | xargs chown $username

This will bundle up the names into larger groups and call 'chown'
on the groups.
-- 
John D. McCalpin                               mccalpin at vax1.udel.edu
Assistant Professor                            mccalpin at delocn.udel.edu
College of Marine Studies, U. Del.             mccalpin at scri1.scri.fsu.edu



More information about the Comp.sys.sgi mailing list