setperms.sh
Quickly fix permissions under one directory. Get it. Or see it…
#!/bin/bash## Fri Aug 19 17:16:21 CEST 2005 * Miguel de Benito <nonick AT 8027 DOT org>## Fixes permissions under one directory## TODO: don't use find -exec but run per-file to be able to check chmod return code#################### Load lib#[ ! -f ~/bin/messages.sh ] && echo "Required file ~/bin/messages.sh not found. Sorry..." && exit 1. ~/bin/messages.sh#################### Check arguments#if [ -d "$1" ]thendir=$1elseif [ -z "$1" ]thendir=.elseerror_msg "Unable to access directory '$1'"exit 1fifi#################### Go:#if ask_msg "chmod 664 every regular file in '$dir' and children?" "Y"thenrun_cmd "Processing... " "find $dir -type f -exec chmod 664 \\{\\} \\;"fiif ask_msg "chmod 775 $dir and every child directory?" "Y"thenrun_cmd "Processing... " "find $dir -type d -exec chmod 775 \\{\\} \\;"fiif ask_msg "chown .users everything under $dir?" "Y"thenrun_cmd "Processing... " "chown -R :users $dir"fi- Download this code: setperms.sh

