Merge branch 'master' of feistymeow.org:feisty_meow
[feisty_meow.git] / scripts / security / easy_perm.sh
diff --git a/scripts/security/easy_perm.sh b/scripts/security/easy_perm.sh
new file mode 100644 (file)
index 0000000..472aa6f
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+# easyperm: traverses directory trees and sets the permissions to a completely
+# accessible value (rwxrwxrwx for directories and rw-rw-rw- for files).
+
+declare -a args=("$@")
+
+if [ -z "${args[*]}" ]; then
+  echo "no arguments provided."
+  exit 1;
+fi
+
+for (( i=0; i < ${#args[*]}; i++ )); do
+  current="${args[i]}"
+#  echo "curr is $current"
+
+  find -L "$current" -type d -exec chmod 777 {} ';'
+# >/dev/null 2>/dev/null
+  find -L "$current" -type f -exec chmod 666 {} ';'
+# >/dev/null 2>/dev/null
+done
+