Retention policies beyond the very simple and common use cases already implemented in Akeeba Backup become incredibly difficult to express using settings, as evidenced by Amazon S3's object retention policies. You end up with something that's either user-hostile, or resembling a programming language.
However, if you go down the latter route, you can always use Rclone in CRON jobs on your computer to implement any kind of arbitrary and/or conditional file retention policy.
For example, deleting files over 6 months old on a remote storage you've set up in Rclone as example and specifically in a folder within it called mybackups is as simple as running rclone delete example:mybackups --min-age 6M
You can go as complicated as you want. Let's say you want to implement the policy "delete files 6 months or older if and only if the total size of the files contained in the mybackups directory is over 100 GiB". You could do it with a shell script like this:
#!/usr/bin/env bash
REMOTE="example:mybackups"
THRESHOLD=$((100 * 1024**3)) # 100 GiB in bytes
# Get total size (bytes) of files
size=$(rclone lsjson --files-only -R "$REMOTE" | \
jq -r '[.[] | select(.IsDir==false) | .Size] | add // 0')
if [ "$size" -gt "$THRESHOLD" ]; then
rclone delete "$REMOTE" --min-age 6M -v
fi
The good thing about using rclone is that it can run on your computer, or any server, and it can support any kind of complexity in your retention rules. You could do totally crazy things like copying the backups taken on the 1st of each month into a separate cold storage area (presumably something cheap and enduring, akin to Glacier), removing files older than 3 months from primary cool storage and files older than 10 years from the secondary cold storage. There are use cases for this kind of retention.
The good news is that Rclone is a very mature project with loads of documentation and discussions on-line which means that asking any LLM for help implementing a complicated retention policy will result in a neat Bash script you can readily use. The most difficult part of the process is trying to describe what your backup retention policy should do.
Nicholas K. Dionysopoulos
Lead Developer and Director
🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!