diff --git a/core/ffmpeg/hlsFilesystemCleanup.go b/core/ffmpeg/hlsFilesystemCleanup.go index 6487a40cf..a8ec87550 100644 --- a/core/ffmpeg/hlsFilesystemCleanup.go +++ b/core/ffmpeg/hlsFilesystemCleanup.go @@ -46,9 +46,8 @@ func getAllFilesRecursive(baseDirectory string) (map[string][]os.FileInfo, error var files = make(map[string][]os.FileInfo) var directory string - filepath.Walk(baseDirectory, func(path string, info os.FileInfo, err error) error { + err := filepath.Walk(baseDirectory, func(path string, info os.FileInfo, err error) error { if err != nil { - log.Fatalf(err.Error()) return err } @@ -63,6 +62,11 @@ func getAllFilesRecursive(baseDirectory string) (map[string][]os.FileInfo, error return nil }) + if err != nil { + log.Fatalf(err.Error()) + return nil, err + } + // Sort by date so we can delete old files for directory := range files { sort.Slice(files[directory], func(i, j int) bool {