#!/usr/bin/perl -w use strict; use File::Find; find( { wanted => sub{ chmod((-f)?0644:0755,$_) if -d||-f } }, defined $ARGV[0] ? $ARGV[0] : '.' );