Capture Retain Data without PLCnext Engineer Backup

I am working on backups taken via shell commands to backup and restore a controller. One aspect I am confused by is the retain data. If I take a backup of the upperdir, my experience is that the program retain data is not transferred with it. If the controller had a different project/configuration before restoring from backup, the retain data is lost. If the controller has a compatible configuration before restoring from backup, the retain data from before is retained.
Is it possible to capture the active retain data via files without utilizing the PLCnext Engineer retain save/restore functions?

Retentive data may be stored in different PLCnext Control devices in different ways, e.g. on an AXC F 2152 there is an NVRAM chip. There is a C++ API that allows this data to be transferred to and from files in a hardware-independent way:
https://api.plcnext.help/api_docs_2022-9/classArp_1_1Plc_1_1Retain_1_1Services_1_1IRetainManagerService.html
This is the API that PLCnext Engineer uses for its save/restore functions.
If you want to save and restore retain data from a PLCnext Control device, then the „simplest“ way is to also use this API.