Solved

Changing directory permissions depending on file type

Posted on 2004-09-28
1
296 Views
Last Modified: 2013-12-16
I have a dir, say /mydir, with literally hundreds of other subdirs in it. Probably thousands.

I want to assign 775 permissions to every dir under /mydir, and 664 to every file. This needs to be recursive, as some dirs under /mydir also have several subdirs inside.

I tried:

#chmod 775 * -R

but this changes EVERYTHING at once. I don't know how to discriminate among dirs an files.

I'm sure this can be done with a shell script, but I'm not very versed in shell scripting.
If no one has an already made script, I could definitely use some pointers.

Thanks.
Poisa
0
Comment
Question by:poisa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 40

Accepted Solution

by:
jlevie earned 120 total points
ID: 12175084
It's a two step process, like:

find /mydir -type d -exec chmod 0755 {} \;
find /mydir -type f -exec chmod 0664 {} \;
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
linux SFTP 8 76
SMB share across internet 15 79
Linux FTP Error 5 44
how to include conditional log rotate in liunx. 17 67
rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question