MCPcopy Create free account
hub / github.com/Facets-cloud/flow / dirSize

Function dirSize

internal/stats/report.go:203–220  ·  view source on GitHub ↗

dirSize sums the byte sizes of files with the given extension under dir. Returns 0 if the directory is missing or empty.

(dir, ext string)

Source from the content-addressed store, hash-verified

201// dirSize sums the byte sizes of files with the given extension under dir.
202// Returns 0 if the directory is missing or empty.
203func dirSize(dir, ext string) int64 {
204 entries, err := os.ReadDir(dir)
205 if err != nil {
206 return 0
207 }
208 var total int64
209 for _, e := range entries {
210 if e.IsDir() || !strings.HasSuffix(e.Name(), ext) {
211 continue
212 }
213 fi, err := e.Info()
214 if err != nil {
215 continue
216 }
217 total += fi.Size()
218 }
219 return total
220}
221
222// ParseSince converts a --since value to a lower-bound time. "all"/"" → zero
223// (no bound); "<N>d" → now minus N days; otherwise RFC3339.

Callers 1

BuildStatsFunction · 0.85

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected