From 3ee6095c4788470370e52c869add463c01ba9541 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Tue, 15 Nov 2022 16:54:18 +0100 Subject: [PATCH] du: Do not count directories in FS mode (#4369) --- cmd/du-main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/du-main.go b/cmd/du-main.go index 5c6a39ba..4124dd41 100644 --- a/cmd/du-main.go +++ b/cmd/du-main.go @@ -167,7 +167,6 @@ func du(ctx context.Context, urlStr string, timeRef time.Time, withVersions bool } if content.Type.IsDir() && !recursive { - depth := depth if depth > 0 { depth-- @@ -184,8 +183,8 @@ func du(ctx context.Context, urlStr string, timeRef time.Time, withVersions bool size += used objects += n } else { - size += content.Size - if !content.IsDeleteMarker { + if !content.IsDeleteMarker && !content.Type.IsDir() { + size += content.Size objects++ } }