-1

I am trying to search all directories with name 'bin' and change the permission of files under all directories which were successfully found. I tried with the below command:

find -type d -name bin -exec chmod 777 {} \;

But this changed the permission of bin directory. It did not change the permission of the files underlying bin. Please help.

Recursively changing the permission with -R as shown in the solution below is the key. Not the solution provided in the similar question.

user3565150
  • 884
  • 5
  • 21
  • 49
  • Possible duplicate of [changing chmod for files but not directories](https://stackoverflow.com/q/1163294/608639), [How to chmod the files based on the results from find command](https://unix.stackexchange.com/q/194878/56041), [How do I set chmod for a folder and all of its subfolders and files?](https://stackoverflow.com/q/3740152/608639), [Recursively chown all files that are owned by a specific user](https://superuser.com/q/648163/173513), [How to recursively chmod all directories except files?](https://superuser.com/q/91935/173513), etc. – jww Jun 02 '18 at 12:53
  • Recursively changing the permission with -R as shown in the solution below is the key. Not the solution provided in the similar question. – user3565150 Jun 02 '18 at 20:33

1 Answers1

1

Your approach was slightly unsuccessful.
Since your bin directory contains another files and directories, you've to change their permission recursively.

$ find -type d -name bin -exec chmod -R 777 {} \;

I Hope, this is what you've expected in return.