forked from TrueCloudLab/restic
Catch errors when walking cache directories
This commit is contained in:
parent
ed651df19b
commit
277cba4b32
1 changed files with 6 additions and 1 deletions
|
@ -152,10 +152,15 @@ func runCache(opts CacheOptions, gopts GlobalOptions, args []string) error {
|
|||
func dirSize(path string) (int64, error) {
|
||||
var size int64
|
||||
err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
|
||||
if err != nil || info == nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !info.IsDir() {
|
||||
size += info.Size()
|
||||
}
|
||||
return err
|
||||
|
||||
return nil
|
||||
})
|
||||
return size, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue