#/bin/bash hidden_files=$(find . | cut -d '/' -f 2 | grep '^\.' | grep -wv '\.') if [ -n "$hidden_files" ]; then find * .[^.]* -type d -print0 | xargs -0 chmod 0755 && find . -type f -print0 | xargs -0 chmod 0644 else find * -type d -print0 | xargs -0 chmod 0755 && find . -type f -print0 | xargs -0 chmod 0644 fi