All pastes #628543 Raw Edit

Anonym

public text v1 · immutable
·published 2007-07-21 11:21 UTC
rendered paste body
#!/bin/bash

glroot=/srv/glftpd
gllog=$glroot/ftp-data/glftpd.log

dirlist="
/site/Archive/APPS:50
/site/Archive/GAMES:10
"

###################################

for entry in $dirlist; do
 workdir=`echo $entry | cut -d ':' -f 1`
 maxdirs=`echo $entry | cut -d ':' -f 2`
 echo "$workdir $maxdirs"
 curdirs=`ls -t1 $glroot/$workdir | wc -l`
 let "remains=curdirs-maxdirs"
 for deldir in `ls -t1 $glroot/$workdir | tail -n $remains`; do
  size=`du -msh $glroot/$workdir/$deldir | cut -f 1`
  rm -rf $glroot/$workdir/$deldir
  echo `date "+%a %b %d %T %Y"` OLDWIPE: \"$workdir/$deldir\" \"$size\" >> $gllog
 done
done


#set variables(OLDWIPE) "%pf %size"
#set disable(OLDWIPE) 0
#set msgtypes(SECTION) "$msgtypes(SECTION) OLDWIPE"
#announce.OLDWIPE = "Freeing %b{%size} from %b{%section} by wiping %b{relname}"