2

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.

lpFranz
  • 123

1 Answers1

6
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 {} \;
muru
  • 197,895
  • 55
  • 485
  • 740
muclux
  • 5,154