All pastes #176551 Raw Edit

Tekhne

public text v1 · immutable
#176551 ·published 2006-09-19 19:23 UTC
rendered paste body
# 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;