Languages

Linux - make all .sh files executable (a+x) for a given directory recursively

4 points
Asked by:
Root-ssh
6840

How can I make all .sh files recursively executable (a+x) below given directory?

1 answers
4 points
Answered by:
Root-ssh
6840

I've found solution using find and ofcourse chmod a+x.

find some_directory -type f -iname "*.sh" -exec chmod a+x {} \;

The command will give a+x rights to all .sh files below some_directory we pick.

Explanation of -iname param:

-iname pattern
  Like -name, but the match is case insensitive.  For example, the patterns `fo*' 
  and `F??' match the file names `Foo', `FOO', `foo', `fOo', etc.
  The  pattern `*foo*` will also match a file called '.foobar'.

 

0 comments Add comment
Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.