Summary
Add a feature to automatically move receipt files into the correct YYMM month subfolder under RECEIPTS_ROOT based on the date parsed from each filename.
Currently, the user must manually place receipts into the right folder (e.g. 2603\ for March 2026) before running a sync. A sorting step would eliminate that manual effort — drop files into an inbox folder, run the sorter, then sync.
Proposed behaviour
- Reads receipt files from a source folder (e.g.
RECEIPTS_ROOT\Inbox\ or a user-supplied path)
- Parses each filename with the existing
ConvertFrom-ReceiptFileName function
- Moves each file to
RECEIPTS_ROOT\YYMM\ (creating the folder if it does not exist)
- Skips and warns on files that fail to parse (
ParseOK = $false) — never moves an unparseable file
- Supports a
-WhatIf / dry-run mode that prints what would move without touching the filesystem
- Reports a summary: N moved, M skipped (with reasons)
Design notes
- Should reuse
ConvertFrom-ReceiptFileName as-is — no changes to the parser needed
- Could be implemented as:
- A new script
Scripts/Sort-Receipts.ps1 (cleaner separation, easier to test)
- Or a
-Sort switch on Sync-Receipts.ps1 that runs before the sync loop
- A standalone script is preferred so sorting can be run independently of syncing
- A corresponding launcher
Launchers/Run-SortReceipts.bat would follow the existing launcher pattern
- The inbox folder path should be configurable (parameter +
Config.env variable, or default to RECEIPTS_ROOT\Inbox\)
- Pester tests should cover: correct target path derivation, skipping unparseable files,
-WhatIf mode, and folder creation
Files affected
Scripts/Sort-Receipts.ps1 — new script
Launchers/Run-SortReceipts.bat — new launcher
Config/Config.template.env — add INBOX_ROOT variable (optional)
README.md, CLAUDE.md — document new script and launcher
Tests/Sort-Receipts.Tests.ps1 — new test file (pure logic; no COM dependency)
Summary
Add a feature to automatically move receipt files into the correct
YYMMmonth subfolder underRECEIPTS_ROOTbased on the date parsed from each filename.Currently, the user must manually place receipts into the right folder (e.g.
2603\for March 2026) before running a sync. A sorting step would eliminate that manual effort — drop files into an inbox folder, run the sorter, then sync.Proposed behaviour
RECEIPTS_ROOT\Inbox\or a user-supplied path)ConvertFrom-ReceiptFileNamefunctionRECEIPTS_ROOT\YYMM\(creating the folder if it does not exist)ParseOK = $false) — never moves an unparseable file-WhatIf/ dry-run mode that prints what would move without touching the filesystemDesign notes
ConvertFrom-ReceiptFileNameas-is — no changes to the parser neededScripts/Sort-Receipts.ps1(cleaner separation, easier to test)-Sortswitch onSync-Receipts.ps1that runs before the sync loopLaunchers/Run-SortReceipts.batwould follow the existing launcher patternConfig.envvariable, or default toRECEIPTS_ROOT\Inbox\)-WhatIfmode, and folder creationFiles affected
Scripts/Sort-Receipts.ps1— new scriptLaunchers/Run-SortReceipts.bat— new launcherConfig/Config.template.env— addINBOX_ROOTvariable (optional)README.md,CLAUDE.md— document new script and launcherTests/Sort-Receipts.Tests.ps1— new test file (pure logic; no COM dependency)