Skip to content

Instantly share code, notes, and snippets.

@andrius
Created September 30, 2015 12:15
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 andrius/7de1623bd6478bd912b2 to your computer and use it in GitHub Desktop.
Save andrius/7de1623bd6478bd912b2 to your computer and use it in GitHub Desktop.
Fixes file permissions in Dropbox folder (windows make them wrong)
#!/bin/sh
cd ~/Dropbox
# Remove conflicted copies
find . -iname '*conflicted copy*' | \
awk -F '-8-8-8-8-8-' '{print "\""$1"\""}' | xargs rm -rf
find . -type f \
-perm 755 \
-not -path "*/bin/*" -not -path "*/script/*" -not -iname "*.sh" \
-print -exec chmod 644 {} \;
find Code -type f \
-not -path "*.git/*" -and \
-path "*/bin/*" -or -path "*/script/*" -or -iname "*.sh" \
-print -exec chmod 755 {} \;
find Projects -type f \
-not -path "*.git/*" -and \
-path "*/bin/*" -or -path "*/script/*" -or -iname "*.sh" \
-print -exec chmod 755 {} \;
find Provisioning -type f \
-not -path "*.git/*" -and \
-path "*/bin/*" -or -path "*/script/*" -or -iname "*.sh" \
-print -exec chmod 755 {} \;
find Shared -type f \
-not -path "*.git/*" -and \
-path "*/bin/*" -or -path "*/script/*" -or -iname "*.sh" \
-print -exec chmod 755 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment