PADFile Operationsarchivecleanupfilesrotation

Archive & Rotate Files

Moves processed output files into a dated archive folder (e.g. Archive\\2026-03-15\\) after each run, and prunes archive folders older than N days to keep disk usage bounded. Runs as a cleanup step at the end of any file-processing flow.

Members OnlySign in or create a free account to view and copy this pattern.

Usage Notes

  • Set varArchiveRoot to the parent archive folder — dated subfolders are created automatically.
  • varRetentionDays controls how long archives are kept. 30 days is a good default for most flows.
  • varSourceFolder is scanned for files matching varFilePattern (e.g.
  • or
  • ).
  • The pruning step deletes entire dated subfolders older than the retention window — make sure the archive root only contains dated folders created by this pattern.
  • Run this at the end of your flow, after all processing is confirmed complete.

Requirements

  • Power Automate Desktop 2.30+
  • Variables: varSourceFolder (Text), varArchiveRoot (Text), varRetentionDays (Number), varFilePattern (Text)