Announcement

Collapse
No announcement yet.

find and chmod

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    find and chmod

    Code:
    find . -type f -exec chmod 660 '{}' ';'
    This command changes all files in a directory to 660. But how it should look like when I don't want to change all files but only those that have 644?

    Or even better how to change all that don't have 660 to 660. The problem is that I don't want overwrite those that already have 660 because it would last to long.
    Last edited by gnomek; Jan 05, 2014, 06:43 AM.

    #2
    Originally posted by gnomek View Post
    Code:
    find . -type f -exec chmod 660 '{}' ';'
    This command changes all files in a directory to 660. But how it should look like when I don't want to change all files but only those that have 644?
    find . -type f -perm 0644 -exec chmod 660 '{}' ';'
    Originally posted by gnomek View Post
    Or even better how to change all that don't have 660 to 660.
    find . -type f ! -perm 0660 -exec chmod 660 '{}' ';'

    Comment

    Working...
    X