cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Alex_ps
Regular Visitor

How to sync two clouds - OneDrive & GoogleDrive includihg sub folders?

I've tried using the template: "When a file is created" > "Create file". But only newly created files are synchronized. But the newly created files IN THE SUBFOLDERS are not synced and the newly created subfolders are not synced either. In the Power Automate (not desktop) I did not find operators like the "Create folder" in the list. Both clouds are enterprices if it matters.

I need to sync all files already existing in one cloud to another new cloud. All newly created folders and files were also synchronized.

Please help!

9 REPLIES 9
v-LilyW-msft
Community Support
Community Support

Hi @Alex_ps 

If you want to use flow to sync all existing files in OneDrive including files in subfolders to GoogleDrive, as far as I know, such a requirement cannot be achieved through the existing features of MS Flow. Because if you want to get the files in the folder from OneDrive, need to use List files in folder action ,but the action can only retrieve files under the specified folder and do not include files under subfolders. 

If you want to sync to GoogleDrive when a new file is created in OneDrive, you take a try with below screenshots.

vLilyWmsft_1-1637818597602.png

vLilyWmsft_2-1637818609347.png

Expression:

last(split(outputs('Get_file_metadata')?['body/Path'],'root:'))

vLilyWmsft_3-1637818634741.png

Expression:

first(split(outputs('Compose'),outputs('Get_file_metadata')?['body/Name']))

vLilyWmsft_4-1637818655511.png

vLilyWmsft_5-1637818692494.png

When a new file is created in OneDrive, the new file will be created in GoogleDrive included in subfolders.(There is no need to manually create a folder in GoogleDrive. When creating a file, if the folder does not exist in googledrive, flow will automatically create a folder)

vLilyWmsft_6-1637819148986.pngvLilyWmsft_7-1637819170483.png

Hope the content above may help you.

Best Regards

If my reply helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks my friend. I believe this method will work. But now I cannot check it, due to constant error. I think the problem is in the service Power Automate. Yesterday the trigger When a file is created worked fine, but today it doesn't.

2021-11-25_19-34-48.png

One more question. How can I redirect the entire OneDrive stream not to the Google root directory, but to a special folder on the Google drive?

I don't really understand the scripts you wrote. It would be nice to explain what each of them means.

Hi @Alex_ps 

When you use When a file is created trigger You don’t need to use Recurrence anymore.

Delete it and save the flow,when you create a new file in OneDrive,  then flow will run automatically after a while.

vLilyWmsft_0-1637889052124.png

These two formulas are to obtain the folder path where the file is stored.

vLilyWmsft_1-1637889285526.png

For example, If my file is stored in the Write folder which is subfolder of the Test folder .

vLilyWmsft_7-1637890363055.png

I only want to get the name of the folder where it is stored. Through these two formulas, I can get the folder name I want.
vLilyWmsft_5-1637890313536.png

 

vLilyWmsft_6-1637890332137.png

Best Regards.

Apparently I asked my question incorrectly. In your example, I want the files from the OneDrive folder "root/Test/Write" to be saved in the GoogleDrive folder "root/OneDrive/Test/Write'. Where can I specify the path "root/OneDrive/Test/Write'?

Hi @Alex_ps 

Please add '/OneDrive' at the beginning of the Folder path field. Then save the flow and try it.

vLilyWmsft_0-1637907628861.png

Best Regards.

I tried changing the path here, but then the files are migrated without subdirectories.

2021-11-26_09-23-40.png

Hi @Alex_ps 

I test on my side and it works well.

When a new file is created in this 'My files>Test11.26-1' in OneDrive.

vLilyWmsft_5-1637911897280.png

The file will be created in 'My Drive>OneDrive>Test11.26-1' in GoogleDrive.

vLilyWmsft_2-1637911190092.png

This is my complete flow.Please reconfirm your flow configuration and try again. 

vLilyWmsft_3-1637911603326.png

Please pay special attention to the configuration of Create file action.

vLilyWmsft_4-1637911860004.png

Best Regards

 

This solution is not suitable for bulk file copying. The flow terminates with an error: The file cannot be created because a file named 'xxxxxxx' already exists in this directory.
I am trying to establish a system of double backup cloud storage: Files from the PC synchronize to OneDrive cloud by using desktop OneDrive utility. Further the file must be copied from OneDrive cloud to Google cloud by using Automate. 

I think the reason is that the files are not copied sequentially, but several at once. And at some point, a new part of the file tries to join the already copied part of the file. As a result, the When a file is created trigger for the same file is fired twice.

 

2021-11-28_10-23-15.png

 

 The second problem is that the Automate creates on Google cloud several subdirectories with the same name instead of one subdirectory.

 

2021-11-28_10-23-35.png

 

 And the third problem is that the flow generally stops copying files after some time. Perhaps the automatic blocking is triggered due to some unsuccessful sessions. That is, the synchronization of the PC with the OneDrive continues, new files appear on the cloud, but nothing is copied to the Google cloud.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (2,546)