#!/bin/bash HACKDIR=$1 USERDIR=$2 ### # clean old ttyrecs ### cd /$HACKDIR/user/$USERDIR/ttyrec/ ls -1tr | head -n -10 | xargs -d '\n' rm -f -- ### # clean sotw files ### cd /$HACKDIR/user/$USERDIR/sotw/ # there are always 4 symlinked files # leave 5 of the latest dumps FILES=$(ls -1tr *.txt | head -n -9) for f in $FILES; do #test -h $f || echo "removing old file $f" if [ ! -h $f ]; then rm -rf $f fi done