Look at Folder object. It has a method for both selecting a folder and retrieve files.
Once that done, you will want to loop through picked up files.
You can then open them and use grep to look up at every number of interest.
I would use an object to store those numbers as a key. So later on if I find a new number, I check if my database object already has this key. If so I would store the name of the documents where I have duplicates.
Eventually you can store this as a txt or csv file for further analysis.
Yes this guide will help with dealing with files and folder objects. Also see
That will help you with driving InDesign
Good luck and share your progress here.
Thanks for the link. Progress will be slow, because I am not trained in scripting, but want to at least give this a shot and see how far I can take it, because it would be very useful in catching potential errors.
Progress will be slow
Well that's why the forum is, help those trying