ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

open file using wild cards

Solved!
Go to solution

does anyone know how to open a file using wild cards in the name.

 

For example, a certain folder will contain a number of files, with the name constructed as follows:

 

CALDB_ then a 6 digit serial number, and then 14 characters which could be ANYTHING.  so it might look like this

 

CALDB_123456_33KA1234567890.txt

or

CALDB_123457_33KA1234567890.txt

 

The key part of the file name is the 6 digit serial number which is unique, and the CALDB_ which is always the same.

 

I would like to use a file open command with the file name something like  CALDB_123456_*.txt, but it doesn't appear to work. 

 

Can anyone help?

Thanks

 

0 Kudos
Message 1 of 6
(3,806 Views)
Is the serial number is some order like consecutive numbers?If so you can use the list file command and build path to do it.
0 Kudos
Message 2 of 6
(3,804 Views)
well it is but not really if that makes sense.  As instruments are made, the information is stored in this folder in the format described. some take longer than others, so they do not come in any order.  As each instrument comes to me, i know its serial number and I know the format of the file name from this serial number.  I don't know (or really care) the last 10 characters of the file name hence the need to use wild cards.  Also there is no operator, so the system needs to open the file automatically, with no dialogue box, from the information known. 
0 Kudos
Message 3 of 6
(3,800 Views)
Solution
Accepted by topic author Dylan

Hi Dylan,

 

I have been searching along our forum, and found a similar question for using wildcards in selecting files. An active user (unclebump) replied on this request with a VI, with which you can select a folder on your computer which is scanned for certain files. I've adjusted this VI for selecting the CALDB_* files. Enclosed you will find this file (zipped) including my test folder.

 

Maybe this will be helpfull for your application.

 

Best regards,

 

Peter Schutte

Message Edited by Peter S on 10-14-2008 03:22 AM
0 Kudos
Message 4 of 6
(3,785 Views)

Hi Dylan,

for a better match to the files it is advisable to use a pattern like "CALDB_??????_*.txt" to find exactly all files with with Prefix CALDB, underscore, six digits, underscore, the 'don't care'- rest and file ending.

 Hope this helps,

Dave

Greets, Dave
0 Kudos
Message 5 of 6
(3,777 Views)

Hi Peter,

 

yes it does help, it does exactly what I need, I have tested it out and it works fine.

Thanks very much

 

 

0 Kudos
Message 6 of 6
(3,771 Views)