Solved

To add file permission to only files recursively?

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

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" …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

821 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