Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

stats: show deletes in stats and hide zero stats

anuar457e602dbf393b
diff --git a/fs/accounting/stats.go b/fs/accounting/stats.go
index 35c8d7db4..a2e44fb60 100644
--- a/fs/accounting/stats.go
+++ b/fs/accounting/stats.go
@@ -292,7 +292,7 @@ func (s *StatsInfo) String() string {
}
}
- _, _ = fmt.Fprintf(buf, "%s%10s / %s, %s, %s, ETA %s%s",
+ _, _ = fmt.Fprintf(buf, "%s%10s / %s, %s, %s, ETA %s%s\n",
dateString,
fs.SizeSuffix(s.bytes),
fs.SizeSuffix(totalSize).Unit("Bytes"),
@@ -313,16 +313,23 @@ func (s *StatsInfo) String() string {
errorDetails = " (no need to retry)"
}
- _, _ = fmt.Fprintf(buf, `
-Errors: %10d%s
-Checks: %10d / %d, %s
-Transferred: %10d / %d, %s
-Elapsed time: %10v
-`,
- s.errors, errorDetails,
- s.checks, totalChecks, percent(s.checks, totalChecks),
- s.transfers, totalTransfer, percent(s.transfers, totalTransfer),
- dtRounded)
+ // Add only non zero stats
+ if s.errors != 0 {
+ _, _ = fmt.Fprintf(buf, "Errors: %10d%s\n",
+ s.errors, errorDetails)
+ }
+ if s.checks != 0 || totalChecks != 0 {
+ _, _ = fmt.Fprintf(buf, "Checks: %10d / %d, %s\n",
+ s.errors, totalChecks, percent(s.checks, totalChecks))
+ }
+ if s.deletes != 0 {
+ _, _ = fmt.Fprintf(buf, "Deleted: %10d\n", s.deletes)
+ }
+ if s.transfers != 0 || totalTransfer != 0 {
+ _, _ = fmt.Fprintf(buf, "Transferred: %10d / %d, %s\n",
+ s.transfers, totalTransfer, percent(s.transfers, totalTransfer))
+ }
+ _, _ = fmt.Fprintf(buf, "Elapsed time: %10v\n", dtRounded)
}
// checking and transferring have their own locking so unlock