Re: chmod
On Wed, May 01, 2002 at 11:15:53AM +1200, Corrin Lakeland wrote:
[other people wrote:]
> > > 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?
> >
> > This one is tougher, I think. 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.
[...]
> Open invitation for any perl monk...
perl -MFile::Find -e 'find (sub {
return unless -f;
my $mode = (stat)[2];
$mode &= ~0060;
$mode |= ($mode & 0600) >> 3;
chmod $mode, $_;
}, "/some/directory");'
At least, that's the most straightforward way that springs to mind,
although it certainly isn't the shortest. It deliberately doesn't touch
directories - remove the 'return unless -f;' line if you want that.
--
Colin Watson [cjwatson@flatline.org.uk]
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to:
- References:
- chmod
- From: Daniel D Jones <ddjones@riddlemaster.org>(by way of Daniel D Jones <ddjones@riddlemaster.org>)
- Re: chmod
- From: "Gary Hennigan" <glhenni@sandia.gov>
- Re: chmod
- From: Corrin Lakeland <lakeland@cs.otago.ac.nz>