Solved

To add file permission to only files recursively?

Posted on 2013-01-24
2
262 Views
Last Modified: 2013-01-27
Hello,

I need to add certain permissions to all files in a directory and all its sub directories, but only to the files and NOT the directories (directories should be excluded).


Thank you in advance
0
Comment
Question by:starhu
[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
2 Comments
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 250 total points
ID: 38813825
find /start/dir -type f |xargs echo chmod [certain permissions]

Please replace [certain permissions] with your desired additional permissions, e.g. add write permissions for group with: "g+w".

echo is for a dry run. Remove it to apply the actual changes.
0
 
LVL 3

Accepted Solution

by:
dextermain earned 250 total points
ID: 38817900
find /dir -type f -exec chmod [pemissions] {} \;

This is the command straight up, the above command will work too and is a safety precaution to do an echo for a dry run.
0

Featured Post

Technology Partners: 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

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

623 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