BASH script for applying permissions recursively

Dane Mutters dmutters at
Thu Jun 29 08:22:29 BST 2006

> > It's a script that can be used to
> > change the permissions of files and directories recursively
> What's wrong with chmod -R?

chmod -R will change the permissions of the files AND directories alike (i. e. 
changing them all to the same thing).  This script will change the files to 
something, and the directories to something else.

> 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 

If this is not the right place to submit such a script, do you know where is?


More information about the ubuntu-devel mailing list