-1

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 {} +
muru
  • 72,889
Young
  • 113

1 Answers1

1

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