How to Automatically Archive SharePoint Files Not Modified for 18 Months
Question details
The user needs a method to automatically move SharePoint files that have not been modified in over 18 months to a separate archive site or folder, while preserving the original complex folder structure across a large environment of over 50 sites.

- Product
- Microsoft SharePoint
- Device & OS
- not provided
- Scenario
- Automating the archiving of dormant files across a large SharePoint environment containing hundreds of gigabytes and hundreds of thousands of files.
- Observed behavior
- Microsoft Purview retention policies only manage age but do not move files. Basic Power Automate flows move the files but fail to recreate or preserve the original folder structure in the destination.
Before building your automated flow, verify that you have Site Collection Administrator permissions for both the source and archive SharePoint sites, and review Power Automate API limits for handling large volumes of files.
Use Power Automate to Move Files and Preserve Folder Structure
Create a scheduled cloud flow in Power Automate that filters files based on their modified date and dynamically recreates the folder path in the archive site.
For large environments containing hundreds of thousands of files, you must configure pagination in your flow to prevent the system from missing files. Additionally, because the default move action does not automatically keep the folder structure, you must extract the original path and build it at the destination.
Open Power Automate, select 'Create', and choose 'Scheduled cloud flow'. Set the recurrence to run weekly or monthly depending on your archiving needs.
Add the 'Get files (properties only)' action for your SharePoint site. In the advanced settings, use an OData Filter Query such as Modified le '@{addDays(utcNow(), -547)}' to target files older than 18 months. Enable Pagination in the action settings and set a high threshold.
Add an 'Apply to each' loop to process the retrieved files. Inside the loop, use expressions to extract the 'Folder path' dynamic content from the source file. Use the 'Create new folder' SharePoint action in the archive site, passing the extracted path.
Add the 'Move file' action. Set the 'File to move' to the Identifier from the source file, and set the 'Destination Site Address' and 'Destination Folder' to the newly created dynamic folder path in the archive site.

Alternative: Use Purview Retention Policies (In-Place Management)
If you decide that moving files is not strictly necessary, you can use Microsoft Purview to automatically delete or retain files in place after 18 months.
Experience Lightweight and Seamless Document Editing with WPS Office
While SharePoint handles enterprise-level file storage and archiving, WPS Office provides a free, highly compatible alternative to Microsoft Office for your daily document creation and editing needs. It is lightweight, features a familiar interface, and ensures a seamless migration from other office suites.
- 1. Download the Installer: Visit the official WPS Office website and click the free download button.
- 2. Install the Software: Run the downloaded installer and follow the on-screen prompts to complete the setup in minutes.
- 3. Open Your Documents: Launch WPS Office and easily open or edit your existing Word, Excel, and PowerPoint files without formatting loss.

Frequently Asked Questions
Why doesn't my Purview retention policy move files to an archive site?
Microsoft Purview retention policies are designed solely for data lifecycle compliance, meaning they can only retain or delete content in place. They do not include the functionality to move or migrate files to a different SharePoint site or folder.
Can Power Automate preserve the original SharePoint folder structure when moving files?
Yes, but it requires a custom configuration. By extracting the source file's folder path property, you can use the 'Create new folder' action followed by the 'Move file' action in Power Automate to dynamically recreate the exact structure in the archive destination.
How do I filter files unmodified for 18 months in a Power Automate flow?
In the 'Get files (properties only)' action, use an OData Filter Query. You can use an expression like Modified le '@{addDays(utcNow(), -547)}' to filter out items that were modified more than 547 days (approximately 18 months) ago.
How do I handle API throttling when archiving hundreds of gigabytes of SharePoint files?
For large environments, you must enable pagination in your Power Automate query actions. It is also recommended to implement error handling and consider breaking down your automated flows to run on a site-by-site or library-by-library basis to stay within Microsoft's API rate limits.




