How to change permissions to certain file pattern/extension?

ivanceras picture ivanceras · Nov 22, 2010 · Viewed 30.7k times · Source

Using chmod, I do chmod +x *.sh in the current directory but what if I want to change all files including files within subfolders that has an sh file extension?.

chmod +x -R * will work but I need something more like chmod +x -R *.sh

Answer

ennuikiller picture ennuikiller · Nov 22, 2010

use find:

find . -name "*.sh" -exec chmod +x {} \;