Skip to content
CampusEduX

File Organizer by Extension

Mediumpython
Learn the Concept: Automation

Create a set of files with given extensions, then organize them into type-based subfolders (.pdf -> PDFs/, .jpg/.png -> Images/, .docx -> Documents/), matching the notes' own organizer.

Approach: create one file per given extension, then move each into the correct subfolder (creating it if needed), and finally report which files ended up in each subfolder.

Input: First line: the number of files n. Next n lines: one extension each (e.g. .pdf).

Output: One line: a list of (subfolder_name, [files]) tuples, sorted by subfolder name.

Related Problems

Input (stdin)

Output

Run your code to see output here...