Tekhne
public text v1 · immutable# Search for files in a directory
use strict;
use File::Find;
use File::stat;
my @dirs = @ARGV;
my $success = open LOG, ">>logfile";
if ( ! $success ) {
print "The logfile failed to open";
}
find(\&attrib, @dirs);
sub attrib {
my $st = stat($File::Find::name) or die "Can't stat $File::Find::name: $!
";
#find world-writeable files in the directory and subdirectories
if ($st->mode & 0002) {
print LOG "$File::Find::name is world-writeable\n";
}
}
close LOG;