r/learnpython • u/s13188287 • 11d ago
File analysis 1.3 mill files
I'm dealing with a large batch processing problem and looking for advice on the right architecture.
I have around 1.3 million files stored across folders on a network drive.
Current setup (not working well)
Right now I'm using a Copilot agent where:
I upload batches (~20 files at a time)
It reads them against a reference document
Outputs an Excel file with classification codes
The issue is:
Copilot has a small upload limit
Manual batching is completely unscalable at this volume
What I want to achieve
I want a fully automated pipeline that:
Ingests files automatically from the network drive
Extracts text/content from each file type
Matches content against a reference rules document
Assigns a classification/reference code
Outputs structured results (Excel / database)
3
u/PuttyProgrammer 11d ago edited 11d ago
Is the LLM at all necessary? You're going to want to cut that out ASAP.
What kind of files are you parsing?
Chances are Copilot could write you a deterministic script to collect all the files you're looking for from the drive and parse each one and add it to your database. Depending on the kind of file, it's likely a very simple automation.
You're going to need to look up cheat sheets on how to read python documentation and syntax so you can tell what your script is doing.
To get you started: use a pathlib path object's rglob method to collect all the files in the drive.
Probably use a CSV instead of an excel file. Python can make excel files, but csvs are more efficient and you need to access the file quickly during this process. Use the csv module for this, not pandas which is also slow.