Skip to content

Instantly share code, notes, and snippets.

@emotality
Created July 7, 2015 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emotality/aaafc7631aa56ee7cfa8 to your computer and use it in GitHub Desktop.
Save emotality/aaafc7631aa56ee7cfa8 to your computer and use it in GitHub Desktop.
Set file and folder permissions in OSX.
#!/bin/bash
#### Created by Jean-Pierre Fourie
### https://github.com/emotality
## set_permissions.sh
#
clear
echo " "
echo " ######################################################### "
echo " ############## FOLDER AND FILE PERMISSIONS ############## "
echo " ######################################################### "
echo " "
echo " ** Note: Make sure the script is in the upper directory where you want to"
echo " set the permission to all the files in the lower directories. **"
echo " "
CURRENT_PATH="`dirname \"$0\"`"
cd "$CURRENT_PATH"
var=$(pwd)
echo " The current working directory is: '$var'"
read -p " Set all Folders permission to [eg. 0751]: " permissions
find . -type d -print0 | xargs -0 chmod $permissions
read -p " Set all Files permission to [eg. 0644]: " permissions
find . -type f -print0 | xargs -0 chmod $permissions
echo " Folders and files permissions set! Exiting. \n"
killall Finder
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment