LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a filtered list of files in a directory

I have got three different naming conventions of files in one directory that I want to work on.  I need to generate a list for each file type separately so that I can parse the data inside.  The naming conventions are as follows.
 
[0-9]+-[0-9].xls  (eg. 24-8.xls)
[0-9]+-[0-9]-RB.xls (eg. 1-5-RB.xls)
abcd-[0-9]+-efgh.xls (eg. abcd-1234567-efgh.xls)
 
I've tried using the List Directory as well as Match String functions, but I can't quite get what I need. 
 
Any help would be very appreciated.
 
Thanks
Paul
 
0 Kudos
Message 1 of 5
(3,066 Views)
I have attached a Vi which can split the file paths. The input can be array of file path.
0 Kudos
Message 2 of 5
(3,052 Views)
Get the list of ALL files (or e.g. pattern "*.xls" in this case), the seperate them using match pattern.
 
See attached simple version (LabVIEW 7.0). Let me know if this is clear. There are many ways to do this. 🙂
Message 3 of 5
(3,045 Views)
Awesome!  Thank you both for the replies.  They are both exactly what I need.
0 Kudos
Message 4 of 5
(3,028 Views)
Be aware that binoi's version does not really match any patterns, so you would get unexpected results if the original list contains any odd file names (most will end up in "Type 1"). Also file names such as QQWEE-RB.xls would falsely end up in "Type 2".
 
You probably need to adjust the patterns in my version to exactly match your needs, but it seems you are familiar with patter matching :).
 
Good luck! 😄
 
 
0 Kudos
Message 5 of 5
(3,020 Views)