in reply to chmod 775 on all files

775 is "readable, writable, executable" for user and group, and "readable, executable" for other. Do you really want every single file to be executable?

If you just want to make executable things that are directories or are already executable for somebody, something like:

chmod -R u=rwX,g=rwX,o=rX
will work.

All of the solutions suggested so far have been to use the command-line chmod tool, because that's by far the easiest way to do it. If there's some reason you want to do this with Perl instead, let us know and somebody will be able to help you with that, too.

Replies are listed 'Best First'.
Re: Re: chmod 775 on all files
by mugwumpjism (Hermit) on Jul 29, 2003 at 19:30 UTC
    chmod -R a=rX,ug+w even.

    The logic of the X chmod flag can easily be implemented using File::Find:

    use File::Find; find(sub { my ($mode) = (stat)[2] & 0777; # see perldoc -f stat my $new_mode = 0664; if ( -d _ or ($mode | 0111) ) { $new_mode |= 0111; } if ($new_mode != $mode) { chmod($new_mode, $_) or warn("Failed to set permissions on " ."$File::Find::name; $!"); } }, "dir");
    $h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/." ."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";