Study Materials Organizer
Use this skill for recurring cleanup of large education-material folders on Windows.
Workflow
- Inventory the target tree with
scripts/inventory_study_materials.py. - Review the inferred category, version, and rename prefix in the CSV.
- Organize with
scripts/organize_study_materials.pyin--dry-runfirst, then rerun with--apply. - Convert Word files to PDF with
scripts/batch_word_to_pdf.pywhen PDF output is required. - Verify counts and review the generated logs before claiming completion.
Use Inventory First
Run:
python scripts\inventory_study_materials.py --root "E:\path\to\folder"
Use the CSV to answer:
- what document types exist
- how files are classified
- which files look like original-paper or answer-side versions
- which names need a source prefix
Organize Safely
Run a dry run first:
python scripts\organize_study_materials.py `
--root "E:\path\to\folder" `
--dry-run
Then apply:
python scripts\organize_study_materials.py `
--root "E:\path\to\folder" `
--apply
Default behavior:
- move files, do not copy
- create a small set of top-level folders
- classify by content markers from
references/classification-rules.md - separate
original,answer, andgenericversions - add a source prefix when the basename starts with ambiguous numbering
- deduplicate by SHA-256 hash before moving
- if the destination name already exists with different content, keep both and prefix the incoming file with
buchongban- - skip Word temp files and generated log folders
Convert Word To PDF Without Formula Garbling
Always use Microsoft Word COM for these teaching-material folders when formulas or MathType objects may exist.
Typical command:
python scripts\batch_word_to_pdf.py `
--root "E:\path\to\folder" `
--pdf-dir-name PDF `
--skip-markers "jiexiban,jiaoshiban,daan,xiangjie,quanjiequanxi,cankaodaan"
Convert everything and delete Word after successful export:
python scripts\batch_word_to_pdf.py `
--root "E:\path\to\folder" `
--convert-all `
--delete-source `
--pdf-dir-name PDF `
--move-existing-pdfs
Behavior:
- preserve relative paths under the target
PDFfolder - restart Word periodically to reduce COM hangs
- overwrite existing same-name PDFs
- delete source
.docor.docxonly after a successful export when--delete-sourceis set - write timestamped logs with success and failure rows
Review Rules
- prefer hash-based duplicate detection over filename-only checks
- keep paths shallow
- merge into an existing useful top-level structure instead of creating a parallel tree
- when ambiguous numbered files land in the same directory, prefix with the nearest useful source folder or chapter label
- treat student, original-paper, exam, test, and practice markers as original-paper side unless the user overrides
- treat teacher, answer, explanation, and solution markers as answer side unless the user overrides
Resources
- Classification rules:
references/classification-rules.md - Inventory script:
scripts/inventory_study_materials.py - Organizer script:
scripts/organize_study_materials.py - Word-to-PDF script:
scripts/batch_word_to_pdf.py