FYI I have now found the reason and solution.
One file had been moved and existed twice with the same file name and path name, that is the same file name was present two times in the same folder. This resulted in the export being corrupted without any error message at all, and the Sync Tree to File to fail with the above mentioned error "2".
To find any and all of the culprit files i used the following MS SQL, where X0P is "your SAP system ID - SID":
select p.FULLPATH, f.[NAME], COUNT(f.ID) total, MIN(f.ID) id1, MAX(f.ID) id2 from X0P.SAPX0PDB.XMII_FILES f inner join X0P.SAPX0PDB.XMII_PATHS p on f.PATHID = p.ID WHERE p.FULLPATH LIKE '%' GROUP BY p.FULLPATH, f.[NAME] HAVING COUNT(f.ID) > 1
I then used the file ID found to display the details about the 2 files to select the one record for deletion:
SELECT * FROM SAPX0PDB.XMII_FILES WHERE ID IN (584, 1086) ORDER BY NAME, CREATED
After deleting the chosen version (i.e. oldest one) a new export did include all the expected files.
Further suggestions:
As we in our case rely on the export function to work correctly it would be very nice if it would at least display a descriptive error message if it encountered errors.
Also the sync file to tree error message "2" should be improved.
Br, Mogens