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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / SharePoint File Archiv...
Power Automate
Answered

SharePoint File Archive Automation

(0) ShareShare
ReportReport
Posted on by 27

Hello,

 

I have an existing flow that saves a file into a SharePoint Shared Documents. The Structure goes:

/Shared Documents/XYZ Folder/

The file is then saved in the 'XYZ' Folder

 

I have another folder within XYZ Folder, called 'Archive', I would like to archive the only excel file in /Shared Documents/XYZ Folder/ into Shared Documents/XYZ Folder/Archive.

 

When building this flow, what I have found is that due to the directory, the flow attempts to move all existing files in 'Archive' to 'Archive' again and it fails. Is there anyway to specifically only move the file that is in  /Shared Documents/XYZ Folder/, without touching the ones in the 'Archive' folder contained within 'XYZ Folder' 

 

This flow will be part of a daily flow, so everyday I will look to move the excel file in /Shared Documents/XYZ Folder/ into Shared Documents/XYZ Folder/Archive, and the flow will continue to save a brand new file in /Shared Documents/XYZ Folder/

 

Thanks

Categories:
I have the same question (0)
  • Rhiassuring Profile Picture
    8,690 Moderator on at

    So someone is dropping one file a day - an xlsx - and you want to move it into the subfolder, archive, daily. 

     

    And it sounds like right now you're telling it to move all items - or are you? Can we see a screenshot of your flow in Edit mode?

    There's lots of ways to do it - you could filter by xlsx, sort by newest, and only take the first one, for example. 

     

    Is the Excel file always named the same way? 

  • threw001 Profile Picture
    27 on at

    Hi thanks for your help

     

    Yes - I actually have a flow that drops an excel file daily into /Shared Documents/XYZ Folder/. What I currently do is manually move the file from the prior day into  /Shared Documents/XYZ Folder/Archive. The file name differs every day as the file name is date/time stamped.

     

    I have messed around with the flow so much it currently doesn't even work 😔

     

    Please see screen shot of flow

     

    FYI the flow I have that creates and drops the file in the directory  is a separate flowArchive.jpg

  • Verified answer
    Rhiassuring Profile Picture
    8,690 Moderator on at

    Try this out - 

     

    Rhiassuring_0-1687479736360.png

     

    This is saying:

    "only show me files that are Excel files"

    "show me the most recently added one first"

    "do not look in subfolders"

    "only give me 1 back"

     

    This should do what you want, if they're dropping in an Excel file to be moved to Archive once a day.

     

  • threw001 Profile Picture
    27 on at

    This worked perfectly!!! Thank you so much 🙂

     

    Just a sidequestion.. maybe more of a sharepoint  question but thought I would ask just in case you have any experience...

    The file that I am moving, multiple people are accessing within the organisation. I am going to have the flow run really late or early hours in the morning so hopefully no one is using or is in the file when the flow to move it activates. In the case some one leaves their laptop on and they are still in the file, the file locks and cannot be moved due to someone being in the file. (just got this error whilst testing just now because someone is actually using the file). Is there anyway around this?

     

    threw001_0-1687482974410.png

     

  • Rhiassuring Profile Picture
    8,690 Moderator on at

    The work-around would be to have check-in/out turned on, and then to force a check-in before moving ... but...  your users might not like that, because if they've got it checked out and are offline, they lose their work (or they can re-upload it later.) 

  • threw001 Profile Picture
    27 on at

    Is there anyway to include this within the flow above?

    I am happy discarding any work if the user is offline/does not save before this flow runs

    Thanks so much again

  • Rhiassuring Profile Picture
    8,690 Moderator on at

    Well, first, do you know if check-in / out is turned on in the library?

  • IS11 Profile Picture
    6 on at

    Can you please share the step by step instructions? My case is I will be having daily excel uploads. So, I want to archive the previous day version into an archive folder in the same root folder and just have the recent ones directly in root folder as that is the path being used in Power BI to fetch the file data.

  • IS11 Profile Picture
    6 on at

    If I have 3 files being uploaded daily and want to auto archive the older versions for each one of those, how to achieve that? This logic just archives the most recently uploaded files among the list

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 339 Super User 2025 Season 2

#1
trice602 Profile Picture

trice602 339 Super User 2025 Season 2

#3
David_MA Profile Picture

David_MA 270 Super User 2025 Season 2

Last 30 days Overall leaderboard