#!/bin/sh

if [ $# -eq 0 ] ; then
    echo "Usage: chm644755 DIR [DIR ...]"
fi

for d in $*
do
  if [ -d $d ] ; then
      chmod 755 $d
      find $d -type f -exec chmod 644 {} +
      find $d -type d -exec chmod 755 {} +
  else
      echo "Not a directory: $d"
      echo "Usage: chm644755 DIR [DIR ...]"
  fi
done
