#!/bin/bash

set -x

CECIHOME=$HOME

if [ -d  $CECIHOME/MAR ] ; then
     cd  $CECIHOME/MAR

     find tmp -type f -atime +10 -mtime +10 -exec rm -vf {} \; 
     find msg -type f -atime +10 -mtime +10 -exec rm -vf {} \; 

     cd $CECIHOME/MAR/sim

     pwd=$PWD

     for dir in GR* EU* AN* ; do
      if [ -d $dir ] ; then
       cd   $dir
       find *.eo                        -type f -mtime +10 -exec rm -vf {} \;
       find *log                        -type f -mtime +10 -exec rm -vf {} \;
       find run/*/*.cmd                 -type f -mtime +5  -exec rm -vf {} \; 
       find input/MARctr/*/MARctr.dat*  -type f -mtime +3  -exec rm -vf {} \; 
       cd   $pwd
      fi
     done

fi

[ -d $HOME/tmp ] && find $HOME/tmp -type f -atime +10 -mtime +10 -exec rm -vf {} \;
[ -d $HOME/msg ] && find $HOME/msg -type f -atime +10 -mtime +10 -exec rm -vf {} \;




