'Copy Sharepoint folder to local drive

I'm new to power automate and have been searching on Microsoft forums and googling a flow to copy all contents of a sharepoint root folder (Documents) to a local drive and cannot find an easy straight forward answer.

All i see is how to copy files to a local drive, which after trying and failing a lot, i finally found 1 flow that helped me do it in 2 steps: 1 - When a file is created; 2 - Create file

What i intend is to backup the root documents folder monthly with all other folder and files included to a local drive with power automate.

Appreciate any help.

Il post the prints on the flow i have right now:

Created Flow

Error after running flow

What happens is that one subfolder is selected and only the files on the subfolder are copied to the local drive, not the subfolder itself, and after that it stops the flow saying no dependent actions succeeded. I was expecting the following: 1 - Select files in folder and copy to chosen path; 2 - Select subfolders with files and create the same subfolders with files on the chosen path;



Solution 1:[1]

First you have to list all the files you need to copy to your Drive using the sharepoint Get Files action: enter image description here

Next, add an Apply to each using the first dynamic content you have on the right side, normally it's a value like showed below, then add sharepoint action Get file content using path. Select the same root directory you used in the Get Files action and in the File Path property use the dynamic content Complete Path. enter image description here

Next, all you have to do is create a new file using the Google Drive action Create File still inside the Apply to each. Use the file name and in File Contents use the dynamic content File contents: enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 osfresia