1

My server downloads its files from git hub to make sure they are up to date and make it easier for me to edit the files. I have set up a cron job that will update the files every few minutes.

However I am having a problem as the CGI files that are being added to the repository do not have the right permissions so they are unable to be executed. I know that

sudo chmod +x *.cgi

Will make the files executable, but the files lie across multiple directories. Is there a way that I can do this in one command. Something along the lines of:

sudo chmod +x */*.cgi
Riley
  • 4,122
  • 3
  • 16
  • 30
  • 1
    Use `find` to get the relevant files, and then pipe the result through to `chmod` … similar to what’s suggested here, https://help.ubuntu.com/community/FilePermissions#Recursive_chmod_using_find.2C_pipemill.2C_and_sudo – CBroe Jun 18 '15 at 15:48

1 Answers1

1

Try to combine find with chmod:

sudo find /path/to/files -name "*.cgi" -exec chmod +x {} \;
Matt
  • 12,848
  • 2
  • 31
  • 53