let rec fold f entry acc = match entry with | Dir(path, name, _, attr, contents) -> f path name attr (List.fold_right (fold f) !*contents acc) | File(path, name, _, attr) -> f path name attr acc | Nothing | Error _ -> acc