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 most recent file ...
Power Automate
Unanswered

Copy most recent file from one folder to another and rename file

(0) ShareShare
ReportReport
Posted on by 225

We have 2 folders...

 

Folder 1: Used to store a daily data output fileS (.xlsx) in.  Each daily file is named similar to "Daily_Spend_Service_20200828_000148", but with the date section changing.

Folder 2: Used by Power Bi to refresh a data report. Power Bi looks for a file called "Upload" in the folder.

 

We need a flow to copy the most recent file found in Folder 1 and copy it to Folder 2, once the most recent file is in folder 2, delete the previous file called "Upload" from folder 2 and rename the newly copied file to "Upload".

 

Is this possible?  Very new to creating Flows, so any guidance would be great.

Categories:
I have the same question (2)
  • efialttes Profile Picture
    14,756 on at

    Yes we can!

    But, we need some more context info...

    Onedrive? Onedrive4Business? Sharepoint?

    Thanx!

  • StuartSmith Profile Picture
    225 on at

    Sorry, yes, both folders are located in Sharepoint Documents...

     

    Documents\Folder 1

    Documents\Folder 2

  • efialttes Profile Picture
    14,756 on at

    Hi!

    In order to copy newest file from folder 1 to folder 2 I would do the following:

     

    Set 'Get files (properties only)' by selecting target site, library name and folder... Set 'Top Count' input to 1 and type the following ODATA expression to 'Order by' input

    Created desc

    Next add an 'Apply to each' action block, assign as its input 'Get files (properties only)' value output... this 'Apply to each will be executed 1 time only, since 'Top Count' was set to 1

     

    Now inside the Apply to each I would add 'Copy file' action block. GReat stuff in this article on this action block

    https://www.chakkaradeep.com/2018/10/10/new-and-improved-sharepoint-copy-move-actions-for-microsoft-flow/

     

    Once you get this part running please let us know so we will work on renaming and deleting

    Hope this helps

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
Valantis Profile Picture

Valantis 641

#2
Vish WR Profile Picture

Vish WR 640

#3
Haque Profile Picture

Haque 495

Last 30 days Overall leaderboard