How should I start building a file-tagging and sorting program?
Asked by
MellowCedar42
I'm learning programming and want to build a tool that can inspect files, extract useful information, assign tags, and organize the files into folders based on those tags. For example, the program might read chat logs, identify the people involved, and let me later find or group all chats associated with a particular person. I'm planning to begin with a command-line interface before considering a graphical interface. What language, file formats, and overall approach would be a good starting point?
Answers
A simple design is to keep a separate index that records each fileโs full path and its tags. When scanning, ask the operating system for the files, inspect each one, generate its tags, and add or update the corresponding entry in the index. Later, searching the index lets you find files by tag without reopening every file. Keep in mind that stored tags can become outdated if a file changes, so you may eventually want to rescan files or store a modification time and check it before using the cached result. Once the tagging works reliably, you can copy or move files into tag-based folders.
Reply to this answer
Python would be a good fit, especially while youโre learning. Look into file objects for reading files and the pathlib module for finding, inspecting, and moving files. JSON could be useful for storing metadata such as file paths, extracted names, and tags. Start with a small command-line version that scans one folder, reads supported files, prints the tags it finds, and only then add sorting or a user interface.
MellowCedar42: That sounds like a good plan. Iโll review Python, pathlib, JSON, and file handling before trying to build the larger system.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowCedar42: Iโll start with a command-line version so I can focus on the scanning and tagging logic before dealing with the extra complexity of a graphical interface.