diff options
Diffstat (limited to 'util/cleandir.pl')
-rw-r--r-- | util/cleandir.pl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/util/cleandir.pl b/util/cleandir.pl index 63b484e4..0e1d5b3a 100644 --- a/util/cleandir.pl +++ b/util/cleandir.pl @@ -1,20 +1,22 @@ #!/usr/bin/perl # $Id$ use strict; +use lib '/home/bbs/bin/'; use BBSFileHeader; my($nDels, $prefix) = (); - +$nDels = 0; foreach( @ARGV ){ print "cleaning: $_\n"; cleandir($_); print "\n"; } +print "$nDels files deleted\n"; + sub toclean { unlink("$prefix/$_[0]"); - print "$_[0]\t"; ++$nDels; } @@ -27,7 +29,12 @@ sub cleandir($) opendir DIR, $dir; foreach( readdir(DIR) ){ - if( /^M\.\d+\.A/ ){ + if( /^\./ ){ + next; + } elsif( -d $_ ){ + print "dir? $_"; + `/bin/rm -rf $prefix/$_`; + } elsif( /^M\.\d+\.A/ ){ $files{$_} = 1; } elsif( (/^SR\./) && (stat($_))[2] < ($now - 86400) ){ toclean($_); |