I would like to write a program that essentially handles text data and metadata of files locally on a machine's filesystem. There is no need for any network activity. I am working with large quantities of sound files in complex directory structures.
Information that the program should be able to quickly access include:
- File names (minimal viable product)
- Embedded metadata from these files (further in the future)
An example usage of this program would be that a user loads the program, provides a root directory, and then that directory and all subdirectories are searched for any audio files such as wav, mp3, flac, aiff, etc...
Say the program finds 25,000 such files. The program needs to track information about these files which can be obtained by parsing characters from the file names, and as aforementioned in a later version, metadata from MP3s such as "artist", "album", etc...
I already know from the programming experience that I do have that not storing this data would mean that every time the program was opened, I would need to re-scan the entire directory structure all over again, which can be time consuming.
I also know that some lighter re-scan would be needed because if the user moves files around or changes names, that could corrupt whatever data store I am using. I've seen that a common solution for this particular issue is to have a interface that lazily checks that the files exist as the user interacts with the program, and displays a "file no longer there" error for any discrepancies.
My question is, what are some architectures and designs I should consider using for such an application? A few ideas that popped in my head:
- On initial load, the program does the deep scan, and stores the full file paths in a "flat text file", one path per line, and then on subsequent runs, this file is queried for the program to reason about (e.g. from there, it can parse different pieces of the file name to work with)
- Rather than a flat text file, something such as a SQLite database could be used and queried
There is a program called "Everything" for Windows which comes to mind because it does a particularly good job at finding and pulling up files FAST, though I do not know how this program is architected or designed beyond what is explained here.
The main concern here is performance - the program interface needs to be snappy and not bogged down by continuous file IO operations because the entire purpose of it is to work with and manage very large sets of files. Not sure if it matters for this particular question, but it will be a cross-platform program capable of running on Windows and MacOS.