diff --git a/cmd/restic/global.go b/cmd/restic/global.go index 942c536ff..9f42f851a 100644 --- a/cmd/restic/global.go +++ b/cmd/restic/global.go @@ -502,8 +502,9 @@ func OpenRepository(opts GlobalOptions) (*repository.Repository, error) { // cleanup old cache dirs if instructed to do so if opts.CleanupCache { - Printf("removing %d old cache dirs from %v\n", len(oldCacheDirs), c.Base) - + if stdoutIsTerminal() && !opts.JSON { + Verbosef("removing %d old cache dirs from %v\n", len(oldCacheDirs), c.Base) + } for _, item := range oldCacheDirs { dir := filepath.Join(c.Base, item.Name()) err = fs.RemoveAll(dir)