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.
1 Answer
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 {} \;
-
-
-
-
@lpFranz
{}
tells find to insert the find results into the formula, the `` in front of the semicolon is just an escape character. May 24, 2018 at 13:06 -
chmod g+r *.* -> The "*.*" do the same thing? I've received this tip.– lpFranzMay 24, 2018 at 13:06