function rchmod --description 'Recursively reset perms of files and folders' -a dmode -a fmode if not command -sq 'find' echo "Can't find find." return 1 end if test (count $argv) -lt 2 echo "Missing arguments." return 1 end find . -type d -exec chmod $dmode {} + find . -type f -exec chmod $fmode {} + end