I am running a loop which needs to access circa 200 files in the directory.
In the folder - the format of the files range as follows:
Here is a cheap way to do it (and by cheap I mean probably not the best/cleanest method):
import glob
l = glob.glob("Excel_[0-9]*.txt")
This will get you:
>>> print(l)
['Excel_19900717_orig.txt', 'Excel_19900717_V2.txt', 'Excel_19900717.txt']
Now filter it yourself:
nl = [x for x in l if "_orig" not in x and "_V2" not in x]
This will give you:
>>> print(nl)
['Excel_19900717.txt']
The reason for manually filtering through our glob is because the glob library does not support regex.
Use ^Excel_[0-9]{8}\.txt
as the file matching regex.