New default format is /var/lib/gromox/user/domain.tld/user
mysql database grommunio.users has those mappings so you could move the folders accordingly to the new style and update the users.maildir in the database.
Or setup a new system and rsync from both servers after just creating the users to have them already and all you need is something like
select substring_index(username, "@", 1) as user, substring_index(username, "@", -1) as domain from users ;
EDIT..
SELECT
substring_index(username, "@", 1) AS USER,
substring_index(username, "@", -1) AS DOMAIN,
maildir AS oldmaildir,
concat('/var/lib/gromox/user/', substring_index(username, "@", -1), "/", substring_index(username, "@", 1)) AS newmaildir
FROM users ;
Well, that could also be extended to retrieve the domain via users.domain_id but that should already be enough in most cases i think