Big Floppy Donkey Disk

Tuesday, September 18, 2012

Recursively chmod only files or directories

Hi Floppers,

I wrote a little script a while back that allows you to recursively change permissions on a directory tree in unix, specifying permissions for either directories or files or both.

From the documentation:
 
# Takes a path to recurse through and options for specifying directory and/or 
# file permissions.
# Outputs a list of affected directories and files.
# 
# If no options are specified, it recursively resets all directory and file
# permissions to the default for most OSs (dirs: 755, files: 644).

Check out chmodr.sh from Gist and feel free to tinker, comment or just use as you wish.