﻿OneMount - Backup Retention for Power Automate
=============================================

The generator builds TWO flows for a SharePoint folder with OneMount backups:

  1-Rotation  Wakes up within minutes of every new backup and keeps the newest N copies per source in that
              folder. A copy younger than the minimum age is never deleted, so a flood of empty archives
              cannot push the real backups out.
  2-Cleanup   Runs once a day. A PC broke, was handed over, its user left: no new backups arrive, so flow 1
              never wakes up for it. After N days without backups only the last copy stays; later it goes too.
              Make this threshold longer than a vacation and than your rarest backup schedule.

Nothing is installed in your tenant. The generator only writes .zip packages (manifest.json + definition.json
with the full flow, your site and library already filled in) that Power Automate imports in a few clicks.

Steps
1. Extract this archive to a normal folder. Double-click Create-RetentionFlow.bat as the SITE OWNER
   (signed in as the owner in the browser too).
2. Paste a link to the SharePoint backup folder (from the browser address bar).
3. A short page with the library ID opens: Ctrl+A, Ctrl+C - the generator window picks it up by itself.
   Easier: paste the address of the library's gear -> Library settings page, it already contains the ID.
4. Answer the questions (Enter = default; each one has a hint).
5. Next to the script you get:
     OneMount-1-Rotation-<site>-<folder>.zip
     OneMount-2-Cleanup-<site>-<folder>.zip
     OneMount-IMPORT-STEPS-<site>-<folder>.txt  - import steps with your names and numbers (opens by itself)
6. Import EACH package: https://make.powerautomate.com -> My flows -> Import -> Import Package (Legacy) ->
   Upload the .zip -> Create as new (leave as is) -> SharePoint Connection row: Select during import ->
   (+ Create and sign in as the site owner if there is no connection) -> click the owner's row so it gets
   a check mark -> Save -> Import.
7. TURN BOTH FLOWS ON in My flows: an imported flow is off. Turn off or delete any older retention flow
   for this folder.

Deletion is permanent (no recycle bin) and touches only "<Source> yyyy-MM-dd HHmmss.zip" files.
No flow 2: answer 0 to the abandoned-PC question. To test rotation: Create-RetentionFlow.bat -Keep 1 -MinAgeDays 0.
Flow 2 can be run at once: open it -> Test -> Manually -> Run flow.

https://onemount.app - SkylFlow
