Files
lush_grading/tasks/filesystem/file_organizer.toml
Cormac Shannon 20e62f60f6 Reorganize task categories from opaque a/b to descriptive names
Replace category_a/category_b directories with algorithm, pipeline,
environment, filesystem, and process. Add separate mode field (solve/convert)
to decouple orchestration from capability grouping. Add per-category
summary and questionnaire breakdowns to both terminal report and HTML export.
2026-03-29 20:59:01 +01:00

30 lines
1.3 KiB
TOML

name = "file_organizer"
category = "filesystem"
mode = "solve"
description = """
You are given a working directory containing several files with extensions.
Read a list of extension-to-directory mappings from stdin, one per line, in the format:
ext:dirname
For example, "txt:documents" means move all .txt files into a subdirectory called "documents".
Create the target directories if they don't exist, then move matching files into them.
After processing, print each moved file as "filename -> dirname/filename", sorted alphabetically by filename.
Files that don't match any mapping should be left in place (don't print anything for them).
"""
[[test_cases]]
stdin = """txt:documents
log:logs"""
expected_stdout = """app.log -> logs/app.log
notes.txt -> documents/notes.txt
readme.txt -> documents/readme.txt"""
setup_files = { "notes.txt" = "some notes", "readme.txt" = "a readme", "app.log" = "log data", "image.png" = "fake png" }
expected_files = { "documents/notes.txt" = "some notes", "documents/readme.txt" = "a readme", "logs/app.log" = "log data", "image.png" = "fake png" }
[[test_cases]]
stdin = "csv:data"
expected_stdout = """report.csv -> data/report.csv"""
setup_files = { "report.csv" = "a,b,c", "other.txt" = "hello" }
expected_files = { "data/report.csv" = "a,b,c", "other.txt" = "hello" }