Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#!/bin/sh
if [ "$1" == "" ]; then
   echo "Usage: $0 <older than (sec)>"
   exit 1
fi

ARCHDIR=archive

current=`date +%s`
olderthan=`expr $current - $1`
echo $current $olderthan
for file in `ls *SM*.root`
do
  time=`echo $file | awk -F _ '{print $2}' | cut -c 1-10`
  if [ $time -le $olderthan ]; then
     echo "Moving file $file in $ARCHDIR"
     mv $file ${ARCHDIR}/
  fi
done

for file in `ls SkimSM*.log`
do
  time=`echo $file | awk -F _ '{print $2}' | cut -c 1-10`
  if [ $time -le $olderthan ]; then
     echo "Moving file $file in $ARCHDIR"
     mv $file ${ARCHDIR}/
  fi
done

for file in `ls SkimSM*.py`
do
  time=`echo $file | awk -F _ '{print $2}' | cut -c 1-10`
  if [ $time -le $olderthan ]; then
     echo "Moving file $file in $ARCHDIR"
     mv $file ${ARCHDIR}/
  fi
done

# archive all ig files.....
mv *.ig  ${ARCHDIR}/