Generalized file grouping functions.