@werwolf969 -- Dude you are a hero among men 😄
I'm looking at modifying your updated (Duplicates=True) version so that it also outputs to /nested/game/path/folder/moddedfile.ext.txt. Reasoning for this is I use ModOrganizr to manage RDR mods. After over a decade of Bethesda modding, I'm spoiled in what a mod manager should do. I'm still limited by what RDR requires to inject modded files, but your scripts and masochist methods of managing modded files is working well -- I think. Because I'm choose to not rely on LMM to handing conflict detection; frankly I'm not even sure LMM has conflict detection outside of looking the log file for OVERWRITE.
My PowerShell-fu is weak and I'm converting Linux shell logic into PowerShell, but I'll get there soon as I figure out the translation and logic differences. My napkin logic (which at this point looks like the broken English of coding) is:
mkdir -p nested\${RemainingPath}\${MatchingFile}.txt
I'm not 100% on which variables make the most sense and obviously that syntax is now PowerShell.