MathsGee Answers is Zero-Rated (You do not need data to access) on: Telkom |Dimension Data | Rain | MWEB
First time here? Checkout the FAQs!
x
Institutions: Global |ALU | Ekurhuleni Libraries | Joburg Libraries | Tshwane Libraries | TUT | UCT | UJ | UNISA | UP | UZ | Wits | Invest in Zim

MathsGee is Zero-Rated (You do not need data to access) on: Telkom |Dimension Data | Rain | MWEB

0 like 0 dislike
31 views
How do you recursively change permissions for all directories except files and for all files except directories?
in Causal Data Science by Diamond (61,020 points) | 31 views

2 Answers

0 like 0 dislike
Best answer

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
by Diamond (61,020 points)
0 like 0 dislike

To change all the directories e.g. to 755 (drwxr-xr-x):

find /opt/data -type d -exec chmod 755 {} \;

To change all the files e.g. to 644 (-rw-r--r--):

find /opt/data -type f -exec chmod 644 {} \;
by Diamond (61,020 points)

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Aug 30, 2019 in Causal Data Science by MathsGee Diamond (61,020 points) | 33 views
0 like 0 dislike
1 answer

Welcome to MathsGee Answer Hub, a free online study network where students can ask, answer, and explore 24/7 for improved outcomes.



MathsGee Supporting City of Joburg

Enter your email address:

MathsGee Tools

Math Worksheet Generator

Math Algebra Solver

Trigonometry Simulations

Vectors Simulations

Matrix Arithmetic Simulations

Matrix Transformations Simulations

Quadratic Equations Simulations

Probability & Statistics Simulations

PHET Simulations

Visual Statistics

Interactive Courseware

ZeroEd Search Engine

Article Rewriter Tool

Word Counter Tool

Other Tools

STEM Gender Equality | ZOOM | Slack | eBook