How to change permissions on many folder with bash

I was trawling the web today and found this quick and painless bash script to change all the default folder premission back to default.

find . -type d -exec chmod 755 '{}' \;

You could of course adapt this script to change ownership of folders by changing the chmod command to chown, but I’ll leave that one for you to work out.

Here’s another to change file permissions back to there default

find . -type f -exec chmod 644 '{}' \;

Happy scripting ;-)

About billy

Senior IT Technician working in Edinburgh, Scotland.
This entry was posted in Computing Tips, Linux, Personal and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>