BASH script for applying permissions recursively

Mikael Eriksson mikael_miffe_eriksson at yahoo.se
Thu Jun 29 14:04:32 BST 2006


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 "{}" \;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20060629/df05c80c/attachment.pgp


More information about the ubuntu-devel mailing list