#! /bin/sh for d in "$@"; do if [ "$d" = .. ]; then echo 'Cannot operate on ".."!' >&2 exit 1 fi find "$d" -type d -print0 | xargs -r0 chmod u=rwX,go=rX find "$d" -type f -print0 | xargs -r0 chmod u=rw,go=r done