#!/bin/bash
# written by sotirk on a cloudy day in May, 2018
# requested by little stuie martin
# no incident number because thats how i roll....

# remove xml files with date stamps + 90 days in the past
for days in `seq 90 95`; do
    SMASHDATE=$(date -d "-${days} day" +%Y%m%d);	
    # remove xml older than 92 days based on filename (catchup)
    echo "*** removing xml files with $SMASHDATE in the filename"
    /usr/bin/find /home/epg/ -type f -name \*${SMASHDATE}.xml -exec rm {} \;
done

# sweeper for removing anything older than 6 months
echo "*** now running 6 month sweeper to catch old things"
/usr/bin/find /home/epg/ -name xsd -prune -o -type f -name \*.x\* -mtime +180 -exec rm {} \;

