LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find files which does not have 770 permissions (https://www.linuxquestions.org/questions/linux-newbie-8/find-files-which-does-not-have-770-permissions-761124/)

zrux 10-11-2009 06:00 AM

find files which does not have 770 permissions
 
I need a script which can throw an error if there are files in a directory which does not have permissions of 770. this should include directores which may contain empty folders.

If there are files which dont have the permission 770 ..the script need to throw an error..

Please can someone help.

markush 10-11-2009 07:30 AM

Hi zrux and wellcome to LQ,

the find-command should work for you. Look at man find and especially for the -perm option.
Code:

find . -perm 770 -print
will find all files with this permissions. You'll have to find out then which files are not printed by the above command.
Another way to make sure that all permissions within a directory are equal to 770 would be to use chmod with the -R option (look at man chmod).

Markus

zrux 10-11-2009 01:17 PM

thanks very much

But how do I find those files which are not printed by the above command?

Tinkster 10-11-2009 01:28 PM

Code:

find . -type f -perm /o=x -ls

AwesomeMachine 10-11-2009 03:13 PM

Try this:

find <path> -perm 770 > 770.txt
find <path> > all.txt
diff -d all.txt 770.txt > diff.txt


And then read diff.txt


All times are GMT -5. The time now is 01:50 AM.