My folder is /images/
. There are .png
, .gif
and .jpg
images in this folder. How do I change permissions of specific file extension .jpg
to 644 under the folder via SSH?
Asked
Active
Viewed 1.0k times
10

Scott Berrevoets
- 16,921
- 6
- 59
- 80

richard
- 1,456
- 4
- 15
- 22
1 Answers
18
Connect to the remote computer with ssh and then execute this command may work:
find /images/. -name "*.jpg" | xargs chmod 644

Guillaume
- 8,741
- 11
- 49
- 62
-
6This won't work in a number of cases, for example if there are any spaces in any of the filenames. Use the `-exec` flag of `find` instead: `find /images/. -name "*.jpg" -exec chmod 0644 {} \;` – Markus Amalthea Magnuson Jun 07 '17 at 13:16
-
1How can we add sudo to this command? I have to execute this with root privilege. – rineez Mar 26 '20 at 10:32