Just wanted to say thanks to @magnakai and @morgan for their solutions. Super useful!
I had a number of field groups so wrote a function that loops over them. Presuming they are structured in the following manner, with a single $group per file.
field-groups/
field/
data.php
field2/
data.php
https://gist.github.com/thisislawatts/2364054d191d062a6f14b711714083eb