- push (@files, "$dir/$word[1]");
- push (@files, map( "$dir/$_",get_filelist_from_known_good_changes("$dir/$word[1]")));
+ @removed = ();
+ push (@files, "$word[1]");
+ push (@files,get_filelist_from_known_good_changes("$dir/$word[1]"));
+ foreach $file ( @files ) {
+ if (!-f "$dir/$file") {
+ msg( "mail,log", "$dir/$file: no such file\n" );
+ }
+ elsif ("$dir/$file" =~ /$conf::keep_files/) {
+ msg( "mail,log", "$dir/$file is protected, cannot ".
+ "remove\n" );
+ }
+ elsif (!unlink( "$dir/$file" )) {
+ msg( "mail,log", "$dir/$file: rm: $!\n" );
+ }
+ else {
+ push( @removed, $file );
+ }
+ }
+ msg( "mail,log", "Files removed from $adelay-day: @removed\n" ) if @removed;