tags:

views:

522

answers:

2

Problems

  1. to get permissions of each file in every folder

  2. to find files which have 777 permissions, and then print the filenames with their paths to a list

We can get permissions for files in one folder by

ls -ls

I do not know how you can get permissions of each file in every folder effectively.

How can you find files which have permissions 777 by AWK/SED/Python?

+5  A: 

Are you looking for find?

find /some/path -perm 0777
sth
Thank you! The solution is beautiful.
Masi
How can I change the permissions for each file which match the criterion? I tried $ find * -perm 777 | chmod 770 unsuccessfully.
Masi
I found the following code $ find * -perm 777 -exec chmod 770 {} \; It seems to work.
Masi
And find ... | xargs chmod 770 also works. Look up xargs. And if you have spaces in your file names, use find ... -print0 | xargs -0
Jonathan Leffler
@Jonathan: Thank you for the clarification!
Masi
+3  A: 

find /some/path -perm 0777 -type f

kzing
The option type is useful. Thank you for pointing it out!
Masi