Change ownership of all folders and subfolders or files

There are often times the permissions on files get a bit confounded and I wish to change them all the be a certain "number". This is different depending on if they are files or folders (and should never be 777).

Change all directories from the current path

$ find . -type d -exec chmod 775 {} \;

Change all files from the current path

$ find . -type f -exec chmod 664 {} \;

These two commands are a life saver - allowing folders a bit more permission than files so that web scripts can update contents inside. Please be wary of what you set permissions to as it could be dangerous!

This code originates from Stack Overflow

This website is currently having a full content audit - apologies if some of the code or content looks a bit funky!

View this post on Gitlab

You might also enjoy…

  • How can I verify my Google Event Tracking is working?

    Posted on 18th September 2017. Written For Liquid Light

    Validating your Google Event tracking is working can be a tricky business. This blog post walks you through checking the data being sent to Google Analytics, so you can verify the information is correct.

  • Navigation drop-downs. Should they be hover or click?

    Posted on 15th August 2017. Written For Liquid Light

    Navigation drop-downs, or mega menus as they are sometimes dubbed, are becoming more and more common on the web. A drop-down menu is a navigation block which appears when a ...

    Web
Mike Street

Written by Mike Street

Mike is a front-end developer from Brighton, UK. He spends his time writing, cycling and coding. You can find Mike on Twitter.