Here's the script I used to cleanup the backup directory I used for brbackup to disk which I discussed from the previous post:
#Find directories under sapbackup backup dir and delete files older than 46 hours. Logs are stored in the log folder
find /backup/XXX/sapbackup/bdu* -type d -mmin +2760 -maxdepth 1 xargs -i ksh -c " echo `/bin/date +%y%m%d%k%M` {} >>/backup/log/sapbackup.log; rm -Rf {}"
#Find files under saparch backup dir and delete files older that 3 days. Logs are stored in the log folder
find /backup/XXX/saparch/*arch* -type f -mmin +4320 -maxdepth 1 xargs -i ksh -c " echo `/bin/date +%y%m%d%k%M` {} >>/backup/log/saparch.log; rm -Rf {}"
Make sure to test it thoroughly.
Disclaimer: use at your own risk!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment