Commands to reorganize the archive ================================= 1. Generate a dry-run plan -------------------------- The script scans every publication folder, computes the normalized filenames, and writes the operations to `reorg_plan.csv` without touching the files. ```bash python3 scripts/normalize_archive.py --plan-output reorg_plan.csv ``` 2. Inspect and spot-check the plan ---------------------------------- Review the CSV before applying the moves. ```bash head -n 20 reorg_plan.csv ``` Look for rows where `date` is `0000-00-00` or `title_sanitized` is `untitled` and update the source filenames (or edit the CSV and rerun the plan) if corrections are needed. 3. Apply the reorganization --------------------------- Once the plan looks good, execute it. This creates `Jihad_Naaman_Archive/`, moves/renames every file, and writes `metadata/files.csv` plus `metadata/reorg_plan.csv` under the new root. ```bash python3 scripts/normalize_archive.py --apply ``` 4. Verify the new structure --------------------------- Spot-check the resulting directories and counts. ```bash find Jihad_Naaman_Archive -maxdepth 3 -type d | sort | head rg --files Jihad_Naaman_Archive/sources | wc -l ``` 5. Clean up the legacy folders (optional) ----------------------------------------- Once you're satisfied, remove the now-empty legacy publication folders to avoid future confusion. ```bash find . -maxdepth 1 -type d ! -name Jihad_Naaman_Archive \ ! -name scripts ! -name '.' -exec rmdir {} + 2>/dev/null ```