How could i iterate over a list of files (within a directory) iterating over a
Eg: Files are '344-444.yml, 555-646.yml and 996-666.yml
File 344-444.yml contains:
Your explanation of the objective is a bit unclear. However, I understood that at a certain point you will have your list of strings (the dictionary) and you have to seach each string on a specific file. A good algorithm for this is the Aho-Corasick algorithm which will give you complexity linear in the length of the file + number of occurences + length of dictionary. If the size of your dictionary is large, this is a huge time gain with respect to looking for one string at a time.