diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-02-14 15:56:39 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-02-14 15:56:39 +0800 |
commit | fdbae2339bd255d3bc75988a2c489786126a254a (patch) | |
tree | 964e1293dc13fd70884dbfbc6925a8a75a841fe5 | |
parent | cdcb4833ed752e5fff610a924fb122c478175ecc (diff) | |
download | pttbbs-fdbae2339bd255d3bc75988a2c489786126a254a.tar pttbbs-fdbae2339bd255d3bc75988a2c489786126a254a.tar.gz pttbbs-fdbae2339bd255d3bc75988a2c489786126a254a.tar.bz2 pttbbs-fdbae2339bd255d3bc75988a2c489786126a254a.tar.lz pttbbs-fdbae2339bd255d3bc75988a2c489786126a254a.tar.xz pttbbs-fdbae2339bd255d3bc75988a2c489786126a254a.tar.zst pttbbs-fdbae2339bd255d3bc75988a2c489786126a254a.zip |
remove dir, no output for single file
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1537 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-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($_); |