- or download this
foreach (@ARGV) {
usagedie() if (!-f || !-d);
}
- or download this
usagedie() if grep not( -f or -d ), @ARGV;
- or download this
find(\&fileop, $opts{'directory'}) unless @ARGV;
find(\&fileop, @ARGV) if @ARGV;
- or download this
find( \&fileop, @ARGV ? @ARGV : $opt_directory );
- or download this
sub fileop {
#set the right permissions based on if a file or a directory
...
chmod oct($opts{'dirmode'}), $_ if -d && $opts{'dirmode'};
print $File::Find::name . "\n" if $opts{'verbose'} && (-f || -d);
}
- or download this
sub fileop {
if( -f and $opt_filemode ) {
...
}
print $File::Find::name, "\n" if $opt_verbose;
}
- or download this
sub check_perm {
my ( $mode, $perm ) = @_;
...
$opt_filemode = check_perm file => $opt_filemode;
$opt_dirmode = check_perm directory => $opt_dirmode;