labview List Directory wildcard bug

  • Permalink
  • submit to reddit
  • Email
  • Follow


When I use the "List Directory" function in labview 7.1 there appears
to be a problem in the function.  The function seems sporadic in
which filenames it will recognize and which it will not if the math
parameter contains multiple wildcards.  In the example I provided,
there are a series of files in the directory with names like 
"calib_LCAL17_RAW_CH1.CSV", " calib_SCAL11_RAW_CH1.CSV" etc.  The
match string I used was "calib" concatenated with
"_*CAL*_RAW_CH1.CSV".  The function returns that no such files
exist when there are 17 such files in the directory. 

On a more positive note, when I use "data" concatenated with
"_*_RAW_CH1_???.CSV" as the match parameter, and a different set of
filenames including "data_5_RAW_CH1_OSL.CSV",
"data_10_FORM_CH1_OSL.CSV" then it correctly finds 10 files.  

I am not sure why but i have tried many different approaches and this
simply does not work.  I have a very long path and perhaps this is
causing problems.

Bryan


CountFilesInDirectory.vi:
http://forums.ni.com/attachments/ni/170/137616/1/CountFilesInDirectory.vi
0
Reply x9561 (148614) 8/16/2005 3:40:48 PM

See related articles to this posting


Well, the problem is that in a directory where there are numerous files
each containing a different numbers (as an example the file " calib_LCAL17_RAW_CH1.CSV" has
the number 17 in it)--the method  returns "1"  meaning that
it only found one matching file.  I checked for spaces, double
underscores, etc before the first post.  The probe shows the
correct  concatenation.  Still it is finding only 1 file
"calib_LCAL1_RAW_CH1.CSV."  Help!  this is so annoying.
Bryan
0
Reply x9561 (148614) 8/16/2005 6:41:19 PM

Sorry CoastalMaineBird, that is not true.  The * wild card can be used anywhere in a filename, and matches any number of characters, including 0 characters.  As a test, I just put a list of text files in my temp directory:
cal_test_cal.txt
cal_1test_cal.txt
cal_1test1_cal.txt
cal_1test123_cal.txt
cal_123test123_cal.txt
Then I wrote a simple vi with List Files, provided the temp directory and the string "cal_*test*_cal.txt" as inputs.  The funtion returned all 5 files.  Works here.  I have no idea why mclaugb is having a problem.  Note:  I am not using quotes in the matching string, they are shown here for clarity.


ListFiles.PNG:
http://forums.ni.com/attachments/ni/170/137679/1/ListFiles.PNG
0
Reply x9561 (148614) 8/16/2005 8:10:55 PM

I have tried it with the standard "List Directory" under advanced
functions and the modified one "List Directory" that I attached before
making my first post.  Neither are working.  I tried *.CSV
which returned the correct number of files.  However "calib*.CSV"
did not.  It only found 1 file and there are many in the
folder.  Just for a test, i eliminated the concatenation and just
typed in a few strings into a constant.  It is still not
working.  I deleted all wires and reconnected them
correctly.  The only thing I can imagine is that perhaps the path
is too long.  I have that pointing to a folder which is about 7
subdirectories deep.  Perhaps the length of the search stops at a
large number of characters.  HELP.  This is really holding me
up!
0
Reply x9561 (148614) 8/16/2005 11:10:56 PM

I thought that you would understand quickly what I meant by RESTRICT, but I see that that I should have explained more.
 
1- you didn't provide "list directory+.vi" in your original post. so I simply replaced it with standard "list directory.vi" of LV.
 
2- you were interested in file names that were matched with you defined pattern, but "list directory.vi" eliminates those files with defined pattern. You see! it means that if there are 17 files matching your pattern and no other files in the specified path, the size of the output array will be zero. because all 17 files are matched with your pattern and consequently are eliminated from the output file names array.
 
Now we have two situations!
 
1- your "list directory+.vi" functions differently from "list directory.vi". perhaps you have built it in a way so it will return  files that match the pattern.
Result: your problem probably comes from that vi. please upload it and let us see it. I tested your program with "list directory.vi" of LV and there is no problem in distinguishing name patterns.
 
2- from the beginning you were not aware of the functionality of "list directory.vi" and thought that it will retunrn matched file names. Actually, with my first reply I supposed that you made a small mistake and misunderstood the functionality of "list directory.vi". I didn't intend to insult you at all and wanted to only mention about the point to let you find it.
 
Cheers,
Soroush
0
Reply x9561 (148614) 8/17/2005 5:41:10 AM

All, 
I now understand what was referred to when by RESTRICT.  I did not
understand that initially so I certainly didn't feel insulted.  I
have managed to sort out the overall problem though which, as i
figured, was something stupid.  I tried a shorter path as someone
suggested by copying all files to another directory.  What helped
me realize the problem was using "dir calib*.csv" which returned only 1
file (there are some 35 in the folder).  I then examined the
filenames carefully and realized there was a space in front of every
filename "calib*.csv" (except one) but not in front of "data*.csv"
which is why "data*.csv" returned correctly and "calib*.csv" did not. I
used some dodgy program to do a batch file rename that apparently added
this space initially which I did not realize.  
Thank you so much for your help.  Without your posts, I would have probably given up and tried to do this another way.
Regards,
Bryan
0
Reply x9561 (148614) 8/17/2005 10:10:52 AM

Soroush said:
2- you were interested in file names that were matched with you defined pattern, but "list directory.vi" eliminates those files with defined pattern. You see! it means that if there are 17 files matching your pattern and no other files in the specified path, the size of the output array will be zero. because all 17 files are matched with your pattern and consequently are eliminated from the output file names array.
 
--------------------------------------
 
Sorry Soroush, this is not true.  The defined pattern is not eliminated by List Directory vi.  It is just the opposite.  The output array contains files that match the pattern.  If this were not so, then the vi I used for an example would have returned all files except the ones I wanted.  My results prove that what I am saying is true.  Try it yourself.  Create a directory, C:\MyTemp, and put in some test files, like test1.txt, test2.txt, etc.  Put it some other files that won't match, like one.txt.  Then create a vi like shown below.  Use test*.txt for a match pattern.  Look at the resulting output array.  This will show that List Directory outputs files that match the pattern.
 
<img src="http://forums.ni.com/attachments/ni/170/137851/1/ListFiles.PNG"> Message Edited by tbob on 08-17-2005  10:14 AM


ListFiles.PNG:
http://forums.ni.com/attachments/ni/170/137851/1/ListFiles.PNG
0
Reply x9561 (148614) 8/17/2005 4:40:55 PM

Yes, You're right, quite right. I couldn't accept that if I hadn't tested it by myself. actually, I've never used this function, but just take a look at detailed help of this VI in LV help docs. the followings are written in explaining the "pattern" parameter:
&nbsp;
pattern:  restricts the files and directories returned to those whose names match 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.
&nbsp;
what do you think when you read such an explanation?:smileyindifferent:
 
 
 
 
 
 
 
 
 
 
Educating thread for me (not&nbsp;about LV), in expense of one star!
0
Reply x9561 (148614) 8/17/2005 5:10:51 PM
comp.lang.labview 35388 articles. 13 followers. Post

7 Replies
123 Views

Similar Articles

[PageSpeed] 41


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

bug with DIRECTORY and search lists
This has been around for a while, I think. I think there are no plans to fix it. Anyone whose code RELIES on this buggy behaviour deserves to have it break. Presumably, correcting the bug would have side effects which would break reasonable code. Can anyone comment on WHY this "works" as it does? ---------8<------------------------------------------------------------------- $ CREATE/DIRECTORY [.A] $ CREATE/DIRECTORY [.B] $ CREATE/DIRECTORY [.C] $ CREATE/DIRECTORY [.D] $ CREATE/DIRECTORY [.Z] $ CREATE [.A]A.A $ CREATE [.B]B.B $ CREATE [.C]C.C $ CREATE [.D]D.D $ DI...

Get a list of files in a directory using wildcards
Hi, Does anyone know how to get a list of files in a directory using a wildcard, like "*.txt"? POSIX compliant functions please. Thanks, Michael On 1 Nov 2005 14:01:18 -0800, Michael McGarry wrote: > Hi, > > Does anyone know how to get a list of files in a directory using a > wildcard, like "*.txt"? ls *.txt man ls for more options. http://www.catb.org/~esr/faqs/smart-questions.html I should have stated that I want to do this using the C programming language, so I am looking for a POSIX API to do this. Thanks, Michael In <1130882478.675830...

Getting a list of files in a directory using a wildcard
Hi, Does anyone know how to get a list of files in a directory using a wildcard, like "*.txt"? Thanks, Michael Hi, Can you specify the environment in which you want to do this? In case of Unix, you can use the globbing functions: ------------------------------------------ SYNOPSIS #include <glob.h> int glob(const char *pattern, int flags, int errfunc(const char * epath, int eerrno), glob_t *pglob); void globfree(glob_t *pglob); ------------------------------------------ Check Section 3 of the manual page for glob. ...

"List Directory" function performance decrease in Labview 7
I have a Labview program that the user inputs a .pdf file name, and the program searches through a nested directory tree and opens the pdf if it finds it. The program uses the "List Directory" function in a loop to first build an array of all of the subdirectories in the main directory. The program worked fine in Labview 6.1 and earlier - consistantly found the file in less than a minute. However, when I upgraded to Labview 7, the search now takes 7-8 minutes. A call to National Instruments said that I am the second person to report the issue, but it is too new to have a work aro...

Listing directory (list directory.vi) performance
I have a problem when using list directory.vi module to get list of files over the network. Directory contains shortcuts in to destination workstation's hard disk. Directory listing takes about 30 seconds to go and there are no other files, only those few shortcuts. When polling directory where there are no shortcuts, it works fine. I need to poll these directories because we are checking incoming new files. There is no difference in processing time when using pattern. Any ideas are welcome. Hi, For checking new files in directory WinAPI functions can be used. Waiting for notification w...

List of directories with a directory
I have a directory with 200 sub directories in it. How do I create a list of the sub directory names? I know how create a list of all the files in a directory: opendir(DIR, $dirname) or die "can't open $dirname: $!"; while (defined($file = readdir(DIR))) { next if($file =~ m/^\./); next if($file eq ""); push (@filenames, $file); } closedir(DIR); but how do I do it for the directories within a directory Al Moodie. On Tue, 29 Jan 2008 19:45:50 -0500, Al Moodie <nospam@nospam.com> wrote: >I have a directory with 200 sub directories in it. How do I create ...

sql for db2 list db directory and db2 list node directory
DB2 8.2.3 is there a sql equivalent to get the information provided by db2 list node directory db2 list db directory. thanks. No as this info is not contained in catalog tables. There migh be a proc in V8.2 or V9.1, a search in Google would reveal that. There's also a a command DB2CFEXP that extracts this info. Regards, Pierre. -- Pierre Saint-Jacques SES Consultants Inc. 514-737-4515 <dcruncher4@aim.com> a �crit dans le message de news: 1162911799.123033.210830@h48g2000cwc.googlegroups.com... > DB2 8.2.3 > > is there a sql equivalent to get th...

List of directories within a directory
I have a directory with 200 sub directories in it. How do I create a list of the sub directory names? I know how create a list of all the files in a directory: opendir(DIR, $dirname) or die "can't open $dirname: $!"; while (defined($file = readdir(DIR))) { next if($file =~ m/^\./); next if($file eq ""); push (@filenames, $file); } closedir(DIR); but how do I do it for the directories within a directory Al Moodie. Quoth Al Moodie <nospam@nospam.com>: > I have a directory with 200 sub directories in it. How do I create a > list of the sub directory na...

Listing directories within a directory
Heya, I'm in need of a way to list the directories inside of a directory using C++ and the linux C libraries. I've tried readdir() and scandir(), however those return the entire contents of a directory -- including the files within. I would like just a list of the directories. Is there a way to do this without downloading another library like boost? Thanks! Regards, Matt Carpenter mattcarpenter@gmail.com wrote: > Heya, > > I'm in need of a way to list the directories inside of a directory > using C++ and the linux C libraries. I've tried readdir() and > sca...

How to list files from directory in list box?
Hi all, Here is what I want to implement: I have several pattern files that'd be sent to special motor controller. What I want is: display these files in the list box on the interface, so that user can click on the file he wants, then run the program, and this file will be the input to my controller. Thank you! So no one knows?? this sux! "Eugene" <viperz@mail.com> wrote in message news:3ac8c2da.0403051154.b091db4@posting.google.com... > Hi all, > Here is what I want to implement: I have several pattern files that'd > be sent to special motor controller. Wha...

How to separate directory list and file list?
With >glob.glob("*") or >os.listdir(cwd) I can get a combined file list with directory list, but I just wanna a bare file list, no directory list. How to get it? Tons of thanks in advance! Gonnasi Hi, 2005/10/23, Gonnasi <harddong@21cn.net>: > With > >glob.glob("*") > > or > >os.listdir(cwd) > > I can get a combined file list with directory list, but I just wanna a > bare file list, no directory list. How to get it? don't know if it is the best solution, but it looks nice. :) path =3D "/home/test" files =3D [fn...

Bug with lists of pairs of lists and append()
Well, could some kind soul please explain to me why the following trivial code is misbehaving? #!/usr/bin/python s = [] l = [ 0 ] r = [0, 0] while r: x = (l,r) print x s.append( x ) l.append( r.pop(0) ) print s The output I get is: ([0], [0, 0]) ([0, 0], [0]) [([0, 0, 0], []), ([0, 0, 0], [])] and the error is in the last line: the two pairs in the outer list are identical and they should be equal to the pairs one the first and the 2nd line, respectively! Shouldn't they? I think I'm going nuts -- for the life of me I don't see what's going on ... Thanks a lot i...

Bugs--Bugs Report in List Operation
I have discovered a bug in both PadLeft[] and PadRight[].<br> Bellow is the test.<br> As the test shows, in PadRight[], Mathematica 5.2 replaced Infinity as 1 automatically, which is not supposed to happen.<br> <br> In[1]:= img = Table[x*10 + y, {x, 3}, {y, 3}] Out[1]:= {{11, 12, 13}, {21, 22, 23}, {31, 32, 33}} ----------------------------------------- In[2]:= PadRight[img, {3, 3}, value, {1, 1}] Out[2]:= {{value, value, value}, {value, 11, 12}, {value, 21, 22}} ----------------------------------------- In[3]:= PadRight[img, {3, 3...

Specifying the Directory to List Box Directory Reader
To whom it may concern, I am using matlab 6.5 in order to implement a graphic user interface thru GUI. I have a problem concerning specifying the Directory to List Box Directory Reader, specifically how do I specify a directory different from Matlab directory using the function lbox2 of the Matlab tutorial, 'List Box Directory Reader'? I forwardly thank you for your help and time. Sincerely, Momo ...

linux bug list/history/mailling list?
hi everyone i wonder if there is a bug list ,bug history or bug mailing list for linux? i wanna stay informed w/ the latest linux bugs as well as find out the past major bugs on linux history if there is, im very much appreciated if you could tell me where i can find it. thank you very much :) -- { Kelvin@!!! } "Kelvin@!!!" wrote: > > hi everyone > > i wonder if there is a bug list ,bug history or bug mailing list for linux? > i wanna stay informed w/ the latest linux bugs as well as find out the past > major bugs on linux history > if there is, im very m...

listing sub directories of a directory using hla
Hi, i need to write a code in HLA, a part of which involves listing the contents of a directory ( i.e. its subdirectories and filecontents) . Any help in this regard will be appreciated. with best regards Prateek Gupta spamtrap@crayne.org wrote: > >i need to write a code in HLA, a part of which involves listing the >contents of a directory ( i.e. its subdirectories and filecontents) . >Any help in this regard will be appreciated. The key piece of information you did not tell us is what operating system you are targetting. The technique is VERY different for DOS, Win32, and Linu...

Bug with lists of pairs of lists and append() #2
Well, could some kind soul please explain to me why the following trivial code is misbehaving? #!/usr/bin/python lst = [ 0, 1, 2 ] s = [] l = [ lst[0] ] r = lst[1:] while r: x = (l,r) print x s.append( x ) l.append( r.pop(0) ) print s The output I get is: ([0], [1, 2]) ([0, 1], [2]) [([0, 1, 2], []), ([0, 1, 2], [])] and the error is in the last line: the two pairs in the outer list are identical and they should be as the pairs on the first and the 2nd line, respectively! I think I'm going nuts -- for the life of me I don't see what's going on ... (I...

List files from directory not in apache web directory
Hello everyone, is it possible to list files from directory other than in apache web directory? my web folder is placed on c:/ and i put my files in windows directory "d:/files/images/". I want those files to be able to view in client browser. when i tested using server computer it succeed. but from client computer i got nothing. I checked the html sources and the files is directly loaded from "d:/ files/images/file_name.jpg" and then i found out why computer client could not load that files. is there any other way to make it happened ? thank you guys for any kind of hel...

LIST "bug": .Remove on an empty list
Although this is easy to code around by checking the length before calling .Remove, I was surprised this just didn't return silently: IDL> l=list(1, length=100) IDL> help,l L LIST <ID=1424588 NELEMENTS=100> IDL> l.remove,/all IDL> help,l L LIST <ID=1424588 NELEMENTS=0> IDL> l.remove,/all % PTR_FREE: Pointer type required in this context: P. % Error occurred at: LIST::REMOVE % LIST::REMOVE % $MAIN$ % Execution halted at: $MAIN$ Passing it along to help the diagnosing of cryptic...

[listings BUG ?] LaTeX listings format multiple dashes
Hi ! As demonstrated by the example below, an lstlisting of, say three dashes formats them in the usual LaTeX way. I would consider it a bug because the purpose of listings is to actually see the code, which you don't in that case. So is this a bug or am I missing something ? I can I overcome it ? Thanks ! PS: I'm using version 1.2, but at a first glance (at the 1.3 doc), things wouldn't be so different with 1.3 -- Didier Verna, didier@lrde.epita.fr, http://www.lrde.epita.fr/~didier EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08 01 85 94276 Le Kremlin-Bic�tre...

4NT file copy/rename wildcard BUG BUG !!
Hi, I posted this bug some time ago, but nobody seemed to understand what I ment. So here is simple example: --CUT--CUT--CUT-- [C:\temp\]copy test_*.* newname_*.* C:\temp\test_file100.txt => C:\temp\jotain\newname_e100.txt C:\temp\jotain\test_file200.txt => C:\temp\jotain\newname_e200.txt C:\temp\jotain\test_file300.txt => C:\temp\jotain\newname_e300.txt C:\temp\jotain\test_file400.txt => C:\temp\jotain\newname_e400.txt 4 files copied --CUT--CUT--CUT-- New filenames should be newname_file200.txt, NOT newname_e200.txt You can try that in old 4DOS and it will wo...

Directory Listing
Hi All, Is there a way I can get a color directory listing on a solarish bash shell ??? Regards - C On Fri, 18 Nov 2005 10:58:36 -0800, chandu3 wrote: > Is there a way I can get a color directory listing on a solarish bash > shell ??? Use GNU ls with the --color argument. On 2005-11-18, chandu33@gmail.com <chandu33@gmail.com> wrote: > Hi All, > Is there a way I can get a color directory listing on a solarish bash > shell ??? Not without installing your own ls command, but ls -F provides similar hints without being too distracting, if that's any use to you. Ce...

directory listing
Hello: Is there a way to obtain a list of files having a specified extension using Fortran /Intel Fortran 9.1? Thanks, -Nachiket On Aug 28, 4:23 pm, gokha...@gmail.com wrote: > Is there a way to obtain a list of files having a specified extension > using Fortran /Intel Fortran 9.1? Look in the on-disk documentation for the library routine GETFILEINFOQQ. If you have further questions about Intel Fortran, please visit our user forum at http://softwarecommunity.intel.com/isn/Community/en-US/forums/1005/ShowForum.aspx or contact Intel Premier Support. Steve Lionel Developer Produ...

Directory listing
Hi I am a new comer to the world of PERL scripting. Can someone let me know how can i right a script to show me the directory sizes on a remote machine Frank Raz (rv01@gre.ac.uk) wrote on MMMMCLVIII September MCMXCIII in <URL:news:DhhHd.280$Z31.44@newsfe1-gui.ntli.net>: ## Hi ## ## I am a new comer to the world of PERL scripting. The language is called Perl. The binary is called perl. There's no such thing as PERL. ## Can someone let me know how can i right a script to show me the directory ## sizes on a remote machine That depends how you access the remote machine. tel...