web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Copy all files from on...
Power Automate
Answered

Copy all files from one folder to another within same SharePoint library using Flow

(0) ShareShare
ReportReport
Posted on by 28

I am trying to use FLOW to automate copying files from one folder (say "Current")  to another folder(say "Archive") within the same library.  But it doesn't seem to work. Do I need to use some dynamic formulas here?

 

Please advice. 

2018-04-13_11-28-14.jpg

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    v-yuazh-msft Profile Picture
    Microsoft Employee on at

     

    Hi @ Yudistara,

     

     

    Do you want to create a flow to copy the file in folder "Current" to folder "Archive" within the same library once a week?

     

    If you would like to use the "Copy file" action if sharepoint connector to achieve your needs, you should fill in the file path in the "Source file path" field and "Destination file path" field of "Copy file" action instead of the folder path.

     

    Please take a try use the "Create file"action to achieve your needs,and refer to screenshot below to create the flow to achieve your needs:

    Capture.PNGCapture1.PNG

     

     

    The expression in the "File Identifier" field of "Get file content" action as below:

    items('Apply_to_each')?['{Identifier}']
     
    The expression in the "File name" field of "Create file" action as below:
    items('Apply_to_each')?['{FilenameWithExtension}']
     

     The flow would run successfully to copy all files from folder "Current" to folder "Archive" as screenshot below:

    Capture.PNG

     

     

     

    Regards,
    Alice Zhang

  • Yudistara Profile Picture
    28 on at

    Thank you @. It worked perfectly with your instructions. Thanks a lot again. 

     

    But now I am trying to figure out how I can delete the file from "Current" folder in our example. Meaning, once the file is copied to Archive folder, the file needs to be deleted from "Current" folder. 

     

    I tried using the "Delete file" action, but not successful. Delete file action also deletes the file from both the folders. I only want to delete the file from the Current folder, but not the Archive folder. Any suggestions are appreciated. 

     

    Thanks.

  • Verified answer
    Yudistara Profile Picture
    28 on at

    OK. I figured it out. Thought i need to share it if someone is looking for the solution. 

     

    All I had to do was get the files, set up a condition if the "folder path" contains the name of the folder in which the file needs to be deleted from.  (See below screenshot) and then delete the file.

    Delete file.jpg

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Very useful!

    Would it be possible to edit the name of the file by adding today’s date at the end of the file name in the destination file path? I imagine it’d be in the Create File step, but what would the expression be? 

  • Mira Ghaly Profile Picture
    11,415 Moderator on at

    @Anonymous 

    Expression will be something like this

     

    concat(split(filename,'.')[0],utcnow('dd/MM/yyyy'),split(filename,'.')[1])

     

     

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard