1

I have a lot of files in one specific folder, and I want to change the permissions only for files and only in this folder (not subfolders), how can I achieve this? Thanks in advance.

5
find your_folder -type f -exec chmod your_permissions {} \;

This command changes the permissions only for regular files in the selected folder (replace "your_folder" and "your_permissions" with the appropriate values).

If you only want to change the permissions for files in your_folder itself and not in its subfolders you can add -maxdepth:

find your_folder -maxdepth 1 -type f -exec chmod your_permissions {} \;
| improve this answer | |
  • what means "{} \" at the end? – lpFranz May 24 '18 at 13:04
  • Ok you beat me to it :) have an upvote. – Videonauth May 24 '18 at 13:04
  • @lpFranz {} stands for what find has found. – muclux May 24 '18 at 13:05
  • @lpFranz {} tells find to insert the find results into the formula, the `` in front of the semicolon is just an escape character. – Videonauth May 24 '18 at 13:06
  • chmod g+r *.* -> The "*.*" do the same thing? I've received this tip. – lpFranz May 24 '18 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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