Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - General Discussion
Unanswered

Copy files from SharePoint to local folder, including folders and nested folders.

(0) ShareShare
ReportReport
Posted on by

I am trying to build a flow which will copy files from a document library to an identical folder structure on a network drive. As agents add reports they need to be copied to folders with the following structure:  Customer/Year/Month.

I am able to copy a file, but when comes to replicating the nested folders, it gets messy. Any help would be greatly appreciated.

  • Community Power Platform Member Profile Picture
    on at
    Re: Copy files from SharePoint to local folder, including folders and nested folders.

    Thanks again for your help. It works just fine but I have two additional questions:

     

    If I file is deleted from the SharePoint folder - can it be deleted from the local folder as well?

    and if a file is renamed in SharePoint, can it be renamed in the local folder too? (right now is duplicating the file, one with the new name is added)

    Thank you.

  • Community Power Platform Member Profile Picture
    on at
    Re: Copy files from SharePoint to local folder, including folders and nested folders.

    Ok I changed the Folder path in "Create File"  by adding the dynamic content "Folder Path" and it did start working. The only issue is the whole folder structure gets coppied to ..\Facility Reports\Facility Reports\

    Not sure why.flow4

     

     

     

  • Community Power Platform Member Profile Picture
    on at
    Re: Copy files from SharePoint to local folder, including folders and nested folders.

    Kris,

    Thank you for your reply. This is exactly what I have. The same flow, but for some reason it does not work for me. Here is the flow:

     

    This is what I get. Note the doubled path on the network drive:

     

    For some reason, it repeats once in Facility Reports. And no folders are  coppied over. 

    The folder structure should be like this:

     

    Facility Reports/Customer ID/Year/Month. So far nothing replicates on the network drive as you can see. A single file will copy if placed in the root of the library Facility Reports/, but nothing else.

  • v-xida-msft Profile Picture
    on at
    Re: Copy files from SharePoint to local folder, including folders and nested folders.

    Hi @Anonymous,

     

    Could you please share more details about your SharePoint library folder structure and your local folder structure?

    Could you please share a screenshot of your flow's configuration?

    Does your SharePoint library has same folder structure with your local folder structure?

     

    I have created a SharePoint library folder structure as below:23.JPG

    I have created a local folder structure as below:22.JPG

     

    I have made a test on my side and please take a try with the following workaround:

    • Add a "When a file is created (Properties only)" trigger, specify Site Address and Library name.
    • Add a "Get file content" action, specify Site Address, File Identifier field set to Identifier dynamic content of the trigger.
    • Add a "Create file" action, Folder Path field set to following formula:

     

    /Folder path dynamic content of the trigger

    File name field set to File name with extension dynamic content of the trigger, File content field set to File Content dynamic content of the "Get file content" action.

     

     

    Image reference:24.JPG

    The flow works successfully as below:25.JPG

     

    When a new file is uploaded into the SharePoint library folder:26.JPG

    The file would be copied into corresponding local folder:27.JPG

     

     

     

    Please also check and see if the following thread would help in your scenario:

    https://powerusers.microsoft.com/t5/Building-Flows/Need-help-creating-Sharepoint-Folders-and-subfolders-with-Flow/m-p/79682/highlight/true#M7941

     

     

    Best regards,

    Kris

     

     

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1