July 12th, 2002, 04:31 PM
CHMOD all files
How would I CHMOD all files with a .pl extension to 755 in my cgi-bin directory (and its subdirectories)? I know how to CHMOD one file, but not recursively on an extension. Thanks for the help.
July 12th, 2002, 06:14 PM
I would have thought the following would work:
chmod -R 755 *.pl
July 12th, 2002, 06:21 PM
Seems to only work for the current directory. It doesn't go to the subdirectories.
July 12th, 2002, 07:34 PM
Hrm, you're right, I tried a few things and couldn't get it to work. You could write a shell or perl script to recurse through the directories and execute the chmod command for you.
July 12th, 2002, 08:06 PM
I've seen it done straight from the command line because I saw my DBA do it once before. I don't know how to write a shell script and I don't know how to recurse through directories in Perl.
July 13th, 2002, 07:45 AM
1) In current working directory:
2) Or specify the root dir:
find . -type f -name "*\.pl" | xargs chmod 755
find /path/to/that/dir -type f -name "*\.pl" | xargs chmod 755
July 13th, 2002, 03:26 PM
Great! It worked. Thanks.