Skip to main content

Notifications

Community site session details
Power Automate - General Discussion
Answered

Transfer files to a different SharePoint site while preserving the folder structure.

Like (0) ShareShare
ReportReport
Posted on 25 Sep 2023 07:17:40 by 3

Hello!

I am trying to create a flow to do the following:

 

Search in a document library for files that haven't been modified in 2 years. If the flow locates a file that matches the condition, this file needs to be moved to an archive library that is on the same site.

The tricky part is that the file must keep the same folder structure when moved.
Also, the folder structure on the source site must not be deleted, since there may be files in the same folder with different modified dates.


Anyone have an idea on how to approach this or have a flow that does the same thing?

  • Verified answer
    SamLed Profile Picture
    2,332 Moderator on 25 Sep 2023 at 08:03:34
    Re: Transfer files to a different SharePoint site while preserving the folder structure.

    Hi,

     

    Tricky part is not so tricky, before using 'Move file' action, use a 'Create folder' action. give it the file folder path minus source library name. It will create the file destination folder hierarchy in a throw. Use slice() function to remove library reference from source file path: 

     

    slice(outputs('Get_file_properties')?['body/{Path}'], indexOf(outputs('Get_file_properties')?['body/{Path}'], '/'))

    ______________________________________________________________

    If I have answered your question, please Accept the post as solution.
    If you like my response, please Thumbs Up.

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

Announcing the Engage with the Community forum!

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Automate - General Discussion

#1
stampcoin Profile Picture

stampcoin 23

#2
Pstork1 Profile Picture

Pstork1 20 Most Valuable Professional

#3
Gprior Profile Picture

Gprior 19

Overall leaderboard
Loading started
Loading started