#!/bin/bash
# http://www.crystalfaeries.net/linux/bin/normalize
# Released under GNU GPL v.3 by celeste:crystalfaery
# 2011-08-17 17:09:56+00:00
# echo -n "shall I recursively normalize file ownership and permissions for public access? (NO/yes):"
# read answer
# if [ "$answer" != "yes" ]
# then exit 0 # unless user answers "yes" we just quit
# fi
user=`whoami`
group=`whoami`
dirs=2775
files=664
sudo find . \( \( -type d \! -perm $dirs -print -exec chmod $dirs {} \; \) -o \
\( -type f \! -perm $files -print -exec chmod $files {} \; \) \)
sudo find . \( \( \! -user $user -print -exec chown $user:$group {} \; \) -o \
\( \! -group $group -print -exec chgrp $group {} \; \) \)
syntax highlighted by Code2HTML, v. 0.9.1