mv ~/full_backup/daily/* ~/full_backup/archive/ &>/dev/null
mkdir ~/AutobackupLogs &>/dev/null
ls -ltr ~/full_backup/archive/ | awk '{print $9}' > ~/AutobackupLogs/dirnames
for i in `cat ~/AutobackupLogs/dirnames`; do
Ptime=$(date +%s -d"$i 00:00:00")
Ctime=$(date +%s)
echo $((Ctime-Ptime)) | awk '{print int($i/86400)}' > ~/AutobackupLogs/timecalc
Cvalue=`cat ~/AutobackupLogs/timecalc`
if [ $Cvalue -gt 2 ]; then
echo "Directory: '$i' removed, $Cvalue days old." >> ~/AutobackupLogs/rmjob
rm -rf ~/full_backup/archive/$i &>/dev/null
fi
done
rm -f ~/AutobackupLogs/timecalc
rm -f ~/AutobackupLogs/dirnames
vim ~/AutobackupLogs/rmjob