asfencounter.blogg.se

Automated folder sync
Automated folder sync




automated folder sync
  1. Automated folder sync how to#
  2. Automated folder sync update#
  3. Automated folder sync full#

I believe that everyone can automate part of their work with the Power Automate platform. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools. My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. Add the various inputs for the folder paths, and a simple functionality might need quite a complex flow. ‘Copy file’ on the other hand can replace a file very easily, but doesn’t create any folders. ‘Create file’ would create the necessary folder structure, but it won’t replace existing files. It’s a bit more complex than needed as there isn’t any action in Power Automate that would do everything you need. The Power Automate flow above will synchronise files between two SharePoint libraries including their folder structure. If the first one fails, you’ll create the folders, and copy the file again. Once the folder is created you can copy the file again with a second ‘Copy file’ action. It’ll take(…) the whole length(…) of the path without the last 1 character. Shared Documents/Folder/SubfolderĪdd the opening / to the ‘Destination Folder’, and follow with an expression that’ll give you the path without the last /. That’s because the action needs the / character on the other side, the ‘Destination Folder’ must have the format below. If you use the ‘Folder Path’, you’ll end up with an error message: “Failed to verify the existence of destination location at…”. It’s slightly different than what the ‘Copy file’ action expects. While the trigger provides you the ‘Folder Path’ dynamic content, e.g. The tricky part is to define the ‘Destination Folder’. Note: You could use also the ‘Create file’ action, but then you’d have to build the replace functionality by yourself.

Automated folder sync update#

This solution will replace the file, but you can also update it if you’d like.

automated folder sync

I prefer using the ‘Copy file’ action as you can easily replace the file if it already exists.

automated folder sync

Copy the fileĪ file (not a folder) was created or modified, now it’s time to copy it. You can save one of the branches if you create the folders only when you need them, together with a file. If you processed also the folders, you’d need two branches in the flow – one for files and one for folders. Start with the trigger ‘When a file is created or modified (properties only)’, and add a trigger condition to run the flow only for files.

automated folder sync

Automated folder sync how to#

And that’s what this post is about: how to synchronise files including their folder path? Run the flow only for files The same should happen when a file is modified – the updated file should stay in the original path. If there’s a new file, maybe even in a new folder structure, it should be synchronised including the folder structure. You want to synchronise only the changes. To keep two libraries synchronised you don’t want to replace all the files over and over again.

Automated folder sync full#

But that was a full copy process, it takes all the files and folders and copies them. There’s already a blog post how to copy files between libraries, even including the folder structure. “Is it possible to synchronise files between 2 SharePoint document libraries with Power Automate, including the folder structure?”






Automated folder sync