LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to list files and folders using pattern

Hi everybody,
How do I list all files and folders in a directory that DOES NOT begin with "m"?
 
In advance, thanx
 
all the best
Georg
0 Kudos
Message 1 of 13
(6,642 Views)
Hello,

I think this VI does more or less what your were asking for, if not exactly I hope you'll be able to modify it to match your needs 😉


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 13
(6,637 Views)
Yes this I also knew how to do 🙂
 
What I'm looking for is at way to do this using the "pattern" input so the files and folders are filtered before they are returned by the "List Folder"-vi, since this reduces the execution time.
 
Thanks for your quick reply though.
 
Cheers
Georg
0 Kudos
Message 3 of 13
(6,637 Views)
I'm not sure I understand what you mean... If for instance you want only LabVIEW VIs to be listed, then link "*.vi" in pattern.

Is that what you wanted or am I missing the point againSmiley Surprised ? If so, can you give an example ?



We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 4 of 13
(6,631 Views)
The "Pattern" input of the file and directory listing VI (in 6.1 at least) is quite limited :

Here's an excerpt from the LV help:

pattern. The pattern matching in this
function is similar to the matching used in matching wildcards in Windows and
UNIX filenames and is not like the regular expression matching performed by the
Match Pattern function. If you
specify characters other than the question mark character (?) or the asterisk
character (*), the function displays only files or directories that contain
those characters. You can use the question mark character (?) to match any
single character. You can use the asterisk character (*) to match any sequence
of one or more characters.


So, if you know of a way to do it with the OS, then this should work, otherwise you'll have to filter after retrieving all files and directories. I had the same problem myself.....

Shane.

Message Edited by shoneill on 08-18-2006 11:32 AM

Message Edited by shoneill on 08-18-2006 11:33 AM

Message Edited by shoneill on 08-18-2006 11:33 AM

Message Edited by shoneill on 08-18-2006 11:34 AM

Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 5 of 13
(6,636 Views)
Hi Georg,

what about this pattern: '~(m*)' ?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 13
(6,620 Views)
Gerd,

That returns nothing on my PC.

Bear in mind that the pattern selection is NOT like that of "match apttern" on the string palette.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 7 of 13
(6,613 Views)
Match pattern only finds it based on the input, you can't exclude. So you either have to find all of the files and directories and filter out the m's, or use multiple patterns without the m. Here is a sample using a*,b*,c*,d* into a for loop. Just increase the number of patterns to search.
0 Kudos
Message 8 of 13
(6,601 Views)
Hi Shane,

I'm using '~(*)' to hide all files and only allow folders. So i was misinterpreting this pattern, but it works for me 🙂

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 13
(6,594 Views)
How does this work?!? I dont get anything when I use ~(*).
I use LabView 8. You?
Could you perhaps send me the vi?
 
Cheers
Georg
0 Kudos
Message 10 of 13
(6,565 Views)