| 1 | from pathlib import Path |
| 2 | import shutil |
| 3 | |
| 4 | ROOT = Path(__file__).resolve().parent / "property-pages" |
| 5 | GROUPS = { |
| 6 | "01-business-planning-and-development": ["0001-", "0002-", "0006-", "0010-", "0015-"], |
| 7 | "02-investment-strategy-and-ownership": ["0003-", "0005-", "0008-", "0011-", "0017-", "0025-"], |
| 8 | "03-rooming-houses-and-multi-occupancy": ["0016-", "0024-", "0035-", "0036-", "0038-", "0039-", "0040-", "0041-"], |
| 9 | "04-rent-to-rent-and-coliving": ["0018-", "0020-", "0021-", "0022-"], |
| 10 | "05-commercial-leasing": ["0023-", "0037-"], |
| 11 | "06-property-management-operations": ["0009-", "0013-", "0014-"], |
| 12 | "07-business-models-and-trends": ["0004-", "0007-", "0012-"], |
| 13 | } |
| 14 | |
| 15 | for folder, prefixes in GROUPS.items(): |
| 16 | destination = ROOT / folder / "sources" |
| 17 | destination.mkdir(parents=True, exist_ok=True) |
| 18 | for prefix in prefixes: |
| 19 | matches = list(ROOT.glob(prefix + "*.md")) |
| 20 | if len(matches) != 1: |
| 21 | raise RuntimeError(f"Expected one match for {prefix}, found {len(matches)}") |
| 22 | shutil.move(str(matches[0]), destination / matches[0].name) |