#!/bin/bash dir='/media/hoard/hoard/' fileshare_group='library-users' fileshare_owner='emily' chown -R $fileshare_owner:$fileshare_group "$dir" find "$dir" -type d -exec chmod 755 {} \; find "$dir" -type f -exec chmod 644 {} \;