#!/bin/sh # -------------------------------------------------------------------------------- # # ======================================D E V E L O P M E N T================================== THEDATE=$(date '+%Y%m%d_%H%M%S') LOGFILE="/Volumes/Server HD/Users/Shared/Application Zip Archive Backups/Development/purge.log" KEEPDAYS=183 TARGET="/Volumes/Server HD/Users/Shared/Application Zip Archive Backups/Development/Daily" # # -------------------------------------------------------------------------------- #Report to Log File echo "***************************************************************************" >>$LOGFILE echo $THEDATE " DELETING FILES OLDER THAN 183 DAYS" >>$LOGFILE find "/Volumes/Server HD/Users/Shared/Application Zip Archive Backups/Development/Daily" -mtime +183 -name "*.zip" | sort >>$LOGFILE # -------------------------------------------------------------------------------- #Report to Console log logger -t FMBACKUP Purging zip files older than ${KEEPDAYS} days from ${TARGET} logger -t FMBACKUP Detailed log is at ${LOGFILE} # -------------------------------------------------------------------------------- #Do the actual purge find "/Volumes/Server HD/Users/Shared/Application Zip Archive Backups/Development/Daily" -mtime +183 -name "*.zip" -exec rm -f {} \; >>$LOGFILE # -------------------------------------------------------------------------------- #Report result to Log File echo "All the files listed above were deleted!!" >>$LOGFILE # # # =====================================P R O D U C T I O N======================================= LOGFILE="/Volumes/Server HD/Users/Shared/Application Zip Archive Backups/Production/purge.log" TARGET="/Volumes/Server HD/Users/Shared/Application Zip Archive Backups/Production/Daily" # # -------------------------------------------------------------------------------- #Report to Log File echo "***************************************************************************" >>$LOGFILE echo $THEDATE " DELETING FILES OLDER THAN 183 DAYS" >>$LOGFILE find "/Volumes/Server HD/Users/Shared/Application Zip Archive Backups/Production/Daily" -mtime +183 -name "*.zip" | sort >>$LOGFILE # -------------------------------------------------------------------------------- #Report to Console log logger -t FMBACKUP Purging zip files older than ${KEEPDAYS} days from ${TARGET} logger -t FMBACKUP Detailed log is at ${LOGFILE} # -------------------------------------------------------------------------------- #Do the actual purge find "/Volumes/Server HD/Users/Shared/Application Zip Archive Backups/Production/Daily" -mtime +183 -name "*.zip" -exec rm -f {} \; >>$LOGFILE # -------------------------------------------------------------------------------- #Report result to Log File echo "All the files listed above were deleted!!" >>$LOGFILE # # =======================================E N D=================================================