How do I change all files (different types including .sh, .py, and other executable files) in a known directory to permission 775 without listing all of the file names?

I mean "all" of them in that directory, no exception.

UPDATED: The command below actually solved the problem for me. Any explanations why "+" instead of a "\"?

find . -type f -name "*.*" -exec chmod 775 {} +

marked as duplicate by user88036, Anthony Geoghegan, muru, Romeo Ninov, Thomas Oct 18 '18 at 9:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


find and chmod

find path_to_dir -type f -name "*.*" -exec chmod 775 {} \;

change *.* to the type of files you would like to change its permissions. *.* will apply the changes to all files in the directory.

  • 1
    As he just wants to change the permissions of the files no matter the type, he can omit -name "*.*" – Nasir Riley Oct 17 '18 at 23:15
  • I got this error: "find: missing argument to `-exec'" when I run this command in the terminal under my target directory. I'm using a . for the path_to_dir part of your answer. – Young Oct 17 '18 at 23:19
  • Sorry about that, it actually worked. I left out the semicolon during my first try. – Young Oct 17 '18 at 23:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.