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" }