[comp.sys.hp] HP UX chown lacks recursive option, Why?

decot@hpisod2.HP.COM (Dave Decot) (05/26/90)

> pyt> cd <wherever_you_want>
> pyt> find . -print -exec chown {} \;
> 
> If there are a lot of files to chown, then the following should be MUCH
> faster:
> 
>   cd <wherever>
>   find . -print | xargs chown <user>

This still invokes chown once per file.

The following will be even faster, since it does the files up to 20 per
invocation of chown:

>   find . -print | xargs -n20 chown <user>

Dave

arne@yc.estec.nl (Arne Lundberg) (05/28/90)

In article <16710054@hpisod2.HP.COM>, decot@hpisod2.HP.COM (Dave Decot) writes:
|>> 
|>>   cd <wherever>
|>>   find . -print | xargs chown <user>
|>
|>This still invokes chown once per file.
|>
|>The following will be even faster, since it does the files up to 20 per
|>invocation of chown:
|>
|>>   find . -print | xargs -n20 chown <user>

                 
From xargs(1) on or HP-UX 7.0 system:

          Flags -i, -l,
          and -n determine how arguments are selected for each command
          invocation.  When none of these flags are coded, the
          initial-arguments are followed by arguments read
          continuously from standard input until an internal buffer is
          full, and then command is executed with the accumulated
          args.  

This seems clear enough to me, without options xargs handles *many*
files per chown.  I can just hope that the internal buffer is bigger than 
1 argument :-).


Arne Lundberg

European Space Technology Centre, Noordwijk, the Netherlands
arne@yc.estec.nl or ALUNDBER@ESTEC.BITNET
Phone: +31 1719 84865, Fax: +31 1719 12142, Telex: 39098

decot@hpisod2.HP.COM (Dave Decot) (05/31/90)

> |>The following will be even faster, since it does the files up to 20 per
> |>invocation of chown:
> |>
> |>>   find . -print | xargs -n20 chown <user>
> 
> From xargs(1) on or HP-UX 7.0 system:
> 
>           Flags -i, -l,
>           and -n determine how arguments are selected for each command
>           invocation.  When none of these flags are coded, the
>           initial-arguments are followed by arguments read
>           continuously from standard input until an internal buffer is
>           full, and then command is executed with the accumulated
>           args.  

Yes, you're right.  Thanks for the correction.

Dave

belkin@teecs.UUCP (Hershel Belkin) (06/08/90)

There is a PD utility called "chall" (available on Interex 9000 
contrib tape) which changes user and group ownership for an
entire subtree in one operation ...

  eg.    chall guest other pathname

will change every file and directory under "pathname" (including
pathname itself) to ownership {guest,other}.  I've found it very
useful, as a system administrator (I believe that you must be "root"
to use it, but I might be wrong -- mine is execute root only)
-- 
+-----------------------------------------------+-------------------------+
| Hershel Belkin               hp9000/825(HP-UX)|      UUCP: teecs!belkin |
| Test Equipment Engineering Computing Services |     Phone: 416 246-2647 |
| Litton Systems Canada Limited       (Toronto) |       FAX: 416 246-5233 |
+-----------------------------------------------+-------------------------+