I have a directory which contains multiple files (some shell ending with .sh, some text files and some python files ending with .py extension).
I want to add execute permission to all shell files (ending with .sh) using os.chmod command. Basically I want to do this:
chmod +x *.sh
I tried checking for permissions first by doing this:
>>> s = os.stat('*.ksh')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 2] No such file or directory: '*.ksh'
But it won't work. How can I do this in pythonic way?