Because it iterates over archives by [A-Z0-9] order, old archive are checked 1st so they are kept even if newer one is available.
Example:
Archives:
archive/20250903-20251212.zip
archive/20251118-20260327.zip
Result:
> Yesterday: '20260128'
- archive dir: './archive'
--------------------
- archive: ./archive/20250903-20251212.zip
- archive start date: '20250903'
- archive end date: '20251212'
- archive is entirely in the past & older than previous one > KEEP as CURRENT
--------------------
--------------------
- archive: ./archive/20251118-20260327.zip
- archive start date: '20251118'
- archive end date: '20260327'
- archive starts before 20260128 and ends after > KEEP as CURRENT
--------------------
Expected:
> Yesterday: '20260128'
- archive dir: './archive'
--------------------
- archive: ./archive/20251118-20260327.zip
- archive start date: '20251118'
- archive end date: '20260327'
- archive starts before 20260128 and ends after > KEEP as CURRENT
--------------------
--------------------
- archive: ./archive/20250903-20251212.zip
- archive start date: '20250903'
- archive end date: '20251212'
- archive is entirely in the past & older than new one > REMOVE
--------------------
Because it iterates over archives by [A-Z0-9] order, old archive are checked 1st so they are kept even if newer one is available.
Example:
Archives:
archive/20250903-20251212.ziparchive/20251118-20260327.zipResult:
Expected: