Search code examples
linuxbashunixfile-permissionschmod

How to change permissions to certain file pattern/extension?


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


Solution

  • use find:

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