First off I want to preface this by working on off these instructions. Trying to modify them to meet my needs.
Where I'm running into issue is using the Folder path reductions.
Destination Path is currently
/Back up/TEST/ take(triggerOutputs()?['body/{Path}'],sub(length(triggerOutputs()?['body/{Path}']),1))
Which turns into /Back Up/TEST/Root Folder/Folder/Subfolder
Instead of /Back Up/TEST/Folder/Subfolder
I know can get the desired output mostly by using this:
join(skip(split(triggerOutputs()?['body/{Path}'],'/'),1),'/')
/Back Up/TEST/Folder/Subfolder/
however it ends up having the trailing / which will cause it to error out and give me a location not found error.
I've been looking up documentation to try and marry the two statements together to get it to product the output I want. However I don't think I understand syntax well enough as each attempt has resulted in invalid formulas.
Image of attempted flow
Man I really got to master those compose functions. Power Automate is still taking time to wrap my head around.
I think you not only solved this problem I had but a few others rattling around my brain!
For any future folks who come across this answer. If you still seem to be spitting out the wrong paths. Make sure you use the right "Compose" dynamic field 😄
@Caspar_Rubin Also you hit the nail on the head. Understood me perfectly.
Hey,
not sure if I understand correctly but if the first Expression is almost correct, why don't you just remove the /Root Folder part from the string using replace()?
You can basically go from this /Back Up/TEST/Root Folder/Folder/Subfolder
to this /Back Up/TEST/Folder/Subfolder
by simply removing the red text, right?
I'd do it like this:
results in this:
Exptression used: replace(outputs('ComposePath'), '/Root Folder', '')
I like using multiple Compose actions after each other before my Copy file actions to keep things clean so I don't have 1000 of functions inside each other. But you could surely do this inside the Copy file action if you're sweaty enough 😉
does that work for you?
cheers
Michael E. Gernaey
497
Super User 2025 Season 1
David_MA
436
Super User 2025 Season 1
Riyaz_riz11
244
Super User 2025 Season 1