Remove core and a.out files
Remove core and a.out files
- Notice the simplicity with the code
- Set this up as a cron job (we can log our clean up activity)
- Consider the shell coding involved
- PERL facilitates a focal point for coding
#!/usr/local/bin/perl
require "find.pl";
$headflag=0;
&find('/home'); exit;
sub wanted {
( /^core$/ || /^a\.out$/) && int(-A $_) > 5 &&
&remove;
}
sub remove{
if ( ! $headflag ) {
print "The following files have been removed:\n";
$headflag=1;
}
print "\t$name\n"; unlink $_ || die “[$!]\n”;
}
The following files have been removed:
/home/mpe/src/comp/a.out
/home/mped/src/q/a.out
/home/mpd/src/varg/a.out
/home/ciad/work/a.out