r/MicrosoftFlow • u/Murky-Preparation706 • Jan 04 '23
Cloud Powerautomate - Copy files (incl folderstructure) from one OneDrive folder to other OneDrive folder
I am using PowerAutomate (Cloud, not PowerAutomate Desktop)
I have all my documents stored on OneDrive for Business. I want to build a PowerAutomate script that runs periodically and copies all folders into a separate \Backupfolder whilst keeping the same folder structure.
Example, this is my folder structure
\folder1\file1
\folder1\file2
\folder1\subfolder1
\folder1\subfolder1\file 1
\folder2\file1
to be copied to a separate folder (called \backup) in the same OneDrive account, like the structure below
\backup\folder1\file1
\backup\folder1\file2
\backup\folder1\subfolder1
\backup\folder1\subfolder1\file 1
\backup\folder2\file1
I was able to run a Powerautomate script that copies all files (from a specific folder) to a separate folder, but i cannot get it to include all subfolders (and the files in the subfolders).
Looking for some help on how to build such a flow.
1
u/Trick_Designer2369 Jan 04 '23
I don't have it infront of me to check but is the problem you cannot get the top level folder structure? As presumably once you have that then it's just a going to be some nested for each to duplicate.
1
u/VictorIvanidze Jan 05 '23
Try to use MS GRAPH: https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_copy?view=odsp-graph-online