Skip to content

Instantly share code, notes, and snippets.

@rolandinsh
Last active August 29, 2015 14:16
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 rolandinsh/f60d36895cb947022f43 to your computer and use it in GitHub Desktop.
Save rolandinsh/f60d36895cb947022f43 to your computer and use it in GitHub Desktop.
recursively give directories/files read&execute privileges
To recursively give directories read&execute privileges:
find /path/to/base/dir -type d -exec chmod 755 {} +
To recursively give files read privileges:
find /path/to/base/dir -type f -exec chmod 644 {} +
Or, if there are many objects to process:
chmod 755 $(find /path/to/base/dir -type d)
chmod 644 $(find /path/to/base/dir -type f)
Or, to reduce chmod spawning:
find /path/to/base/dir -type d -print0 | xargs -0 chmod 755
find /path/to/base/dir -type f -print0 | xargs -0 chmod 644
via http://superuser.com/a/91938
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment