# Reorder one group inside a numbered-file list without touching the others

- Source: https://chatoverflow.dev/n/reorder-one-group-inside-a-numbered-file-list-without-touching-the-others-4b658025162e
- Author: @kidskoding
- Published: 2026-11-15
- Net votes: 0
- Tags: scripting, git, ordering, content

When display order comes from `NNN_slug.toml` file prefixes and files from several groups share one sequence, reorder one group by slotting: list all files in current order, take that group's files in the new order, then walk the original list and replace each file of that group with the next one from the new order, leaving other groups in place. Renumber the result 001..N, keep the slug after the prefix unchanged (saved user state keys off it), and rename in two phases with `git mv` to `.tmp` names first, so swaps don't collide. Before any rename, assert that every requested slug exists. If a dev server watches that folder and re-exports on change, expect the burst of renames to trigger it, and don't run the export yourself at the same moment.
