diff --git a/remove-old-wordpress-backups/remove-wordpress-backups.sh b/remove-old-wordpress-backups/remove-wordpress-backups.sh
index faeff91..3bc6f23 100644
--- a/remove-old-wordpress-backups/remove-wordpress-backups.sh
+++ b/remove-old-wordpress-backups/remove-wordpress-backups.sh
@@ -400,16 +400,24 @@ build_html_report() {
counts_html+="
| ${domain} | ${found} | ${size} | ${newest} | ${oldest} |
"
if [ "${removed_count}" -gt 0 ]; then
- local files_html=""
+ row_bg="#ffffff"
+ [ $(( i % 2 )) -eq 1 ] && row_bg="#fff3f3"
+ local f fname fdate fsize
while IFS= read -r f; do
- [ -n "${f}" ] && files_html+="$(printf '%s' "${f}" | html_escape)"
+ [ -n "${f}" ] || continue
+ # Split "filename (date, size)" back into its parts for the table columns
+ if [[ "${f}" =~ ^(.*)\ \(([^,]+),\ (.+)\)$ ]]; then
+ fname="${BASH_REMATCH[1]}"
+ fdate="${BASH_REMATCH[2]}"
+ fsize="${BASH_REMATCH[3]}"
+ else
+ fname="${f}"; fdate="-"; fsize="-"
+ fi
+ removed_html+="| ${domain} | $(printf '%s' "${fname}" | html_escape) | ${fdate} | ${fsize} |
"
done <<<"${removed_files}"
- removed_html+="${domain} - ${action_title}: ${removed_count}"
fi
done
- [ -n "${removed_html}" ] || removed_html="(none)"
-
cat <
@@ -423,8 +431,24 @@ build_html_report() {
Backups ${action} by domain
-
+EOF
+ if [ -n "${removed_html}" ]; then
+ cat <
+
+ | Domain |
+ File |
+ Date |
+ Size |
+
+ ${removed_html}
+
+EOF
+ else
+ echo ' (none)
'
+ fi
+ cat <Backups found by domain