Add per-domain disk space usage to backup report - #25
Merged
Conversation
- Capture backup file sizes in scan_domains() alongside dates, using find's -printf to grab epoch/size/path in one pass - Add human_size() helper using numfmt (falls back to plain bytes if numfmt is unavailable) to format sizes as human-readable (e.g. "1.2GiB") - Add a "Disk Space" column to the found-by-domain table in both the plain-text report (console/dry-run) and the HTML email report - Append size to each removed-file entry, e.g. "backup-1.tar.gz (2025-07-20, 5.0MiB)" - Add total disk space used to the summary line/row in both report formats - Update README and script header docs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds per-domain disk space usage (human-readable) to the WordPress backup cleanup report, as a follow-up to the recent dates/formatting improvements.
Changes
scan_domains()now captures each backup file's size alongside its mtime date, using a singlefind -printf '%T@ %s %p'passhuman_size()helper formats byte counts as human-readable strings (e.g.15.0MiB,500.0KiB) vianumfmt, with a plain<bytes>Bfallback ifnumfmtisn't availablesize: <human-readable>backup-1.tar.gz (2025-07-20, 5.0MiB)0.0B(no crash)Testing
shellcheckpasses cleanly (only the pre-existing, intentionalSC2086info on the unquotedBACKUP_PATHglob)0.0Bmailcommand) renders the new column correctlyCo-authored-by: Copilot 223556219+Copilot@users.noreply.github.com