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

Re: chmod



On Tue, Apr 30, 2002 at 04:37:09PM -0600, Gary Hennigan wrote:
>
> [snip previous issue]
> 
> Well, in Unix you typically string a bunch of simple tools together to
> accomplish complex tasks. You almost had it with your "ls" solution,
> but try "find" instead, and use xargs. Here's how I do what you're
> trying to accomplish:
> 
>         find <dirname> -depth -type d -print|xargs chmod 770
> 
> > And if anyone's in a 'splaining mood, here's another one: how do you set all
> > files so that the group permissions match the user permissions?  (If you have
> > three files who's permissions are, for example, 700, 600, 500, and you want
> > them to be 770, 660, 550 respectively.)
> 
> This one is tougher, I think. I'd write a script to do it. Maybe
> someone has a brighter idea. The complication here is that there's not
> a good shell command, or unix utility, to simply report the mode of a
> file in numerical form, at least that I'm aware of. You could write
> such a utility pretty easily in C using the "stat()" function, but
> even though it's simple it seems like over kill. Gotta be a better
> way.

No script needed, thanks to the forethought of the authors of chmod:

find <dirname> -type f -print0 | xargs -0 chmod g=u,o=

-- 
Karl E. Jørgensen
karl@jorgensen.com
www.karl.jorgensen.com
"One disk to rule them all, One disk to find them. One disk to bring
 them all and in the darkness grind them. In the Land of Redmond
 where the shadows lie." -- The Silicon Valley Tarot
          Henrique Holschuh

Attachment: pgpLalHtqv48_.pgp
Description: PGP signature


Reply to: