Solved

To add file permission to only files recursively?

Posted on 2013-01-24
2
223 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
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
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.:
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.

910 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now