BASH script for applying permissions recursively
Micah J. Cowan
micah at cowan.name
Thu Jun 29 22:12:49 BST 2006
On Thu, Jun 29, 2006 at 03:04:32PM +0200, Mikael Eriksson wrote:
> On Thu, Jun 29, 2006 at 12:22:29AM -0700, Dane Mutters wrote:
> > > Your script is interesting but I'm not sure that this mailing is the
> > > right place for it (really it could do with been on a "Unix Hacks"
> > > website). It may also be possible to do something similar with two
> > > commands e.g.
> > > find pathtodir -type d -exec chmod 664 {} \;
> > > find pathtodir -type d -exec chmod 755 {} \;
> >
> > I tried using those commands a while ago, and found that they choked on
> > filenames with strange characters in them. I have tested this on the
> > contents copied from an 80GB vfat hard drive, with all manner of strange
> > filenames accumulated over the years, and have not found one that it can't
> > do.
>
> Try find path -type d -exec chmod 755 "{}" \;
> find path -type f -exec chmod 644 "{}" \;
I don't see why that would work... it gets turned into exactly the same
argument string to chmod. Maybe you meant '"{}"' ? ...but in that case,
it won't handle double-quotes in the name. And it won't actually work,
anyway... (the quotes will be in the literal argument to chmod).
Sounds like a bug in find. I think fixing the bug in find would be
preferable to using a new script.
--
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/
More information about the ubuntu-devel
mailing list