#!/bin/bash

count=$(find Backups/DomoticzDB/ -name domoticz*db.gz -mtime -31 | wc -l)

if [ $count -gt 0 ]
then
  find Backups/DomoticzDB/ -name domoticz*db.gz -mtime +31 -delete
  echo "$count files younger than 31 days, older files deleted"
else
  echo "No files younger than 31 days, older files (if any) not deleted"
fi

ssh woopi@goldserver.local  /home/woopi/.local/bin/upload
