Tekhne
public text v1 · immutable# Search for files in a directory
use strict;
use File::Find;
use File::stat;
my @dirs = @ARGV;
open(LOG, ">>", "logfile") or die("The logfile failed to open: $!\n");
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;