#!/usr/bin/perl -w use strict; use File::Find; my $topdir = shift || '.'; my $filemode = shift || 0644; my $dirmode = shift || 0755; find(\&doit, "$topdir"); #this sub causes files to be 0755 instead of 0644 sub doit { return if -d and /^\.\.?$/; chmod($filemode, $_) if (-f $_) or warn $!; chmod($dirmode, $_) if (-d $_) or warn $!; }