I have a column of strings in a table representing the filenames in a folder as produced by the dir function.
tmpList = struct2table(dir('myFolder'));
The folder contains many different file types and folders. I want only the excel files and I can find these by using:
filesData = [dir(['myFolder','\*.xlsx']);dir(['myFolder','\*.xls'])];
However how do I expand this/ replace this such that I can filter tmpList.name to include only files which have the following attributes:
- First three letters are: 'DTE' (which occurs as both caps or small case)
- All the characters following DTE are only numbers (and only numbers between 6 and 8 characters long)
- Extension is .xlsx or .xls
example, for the following list only 1 and 2 are identified to keep:
- 'DTE123456.xlsx'
- 'Dte01234567.xls'
- 'abc12345678.xlsx'
- 'DTE12345c34.xls'
- 'DTE123456.doc'