02-13-2013 08:56 AM
Hello and greeting from your friend,
I'm looking for a command or a small programme wich serachs files by their names in directories and returns a boolean value, true if that file exist and false if not.
Thanks
Solved! Go to Solution.
02-13-2013 09:14 AM
If you really want to do that in LabVIEW, you can with the OpenG VI List Dir Recursive :
hope this helps
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
02-13-2013 09:21 AM
Maybe the "Check if File or Folder Exists" function in LV is better suited given the path to the source is already known and shall be checked.
Otherwise, i would use "Recursive File List" directly from LV since it does not require you to install OpenG.
On the other hand, OpenG brings a lot of additional, nice functions so it could still make sense......
Norbert
02-13-2013 09:37 AM
Thank you very much Dears,
@TiTou
The OpenG VI seems very interesting, but I can download that library, please bring me another links !
Your solution works well. But I need one more thing please ... I want to search all files whose name begins or ends with "Toto" for example. Is it possible in Labview ??
Thanks
02-13-2013 09:51 AM - edited 02-13-2013 09:54 AM
You can use the recursive file list function to create an array of filenames. Then do a string search within this array:
Your regalar expression would be "^Toto". Refer to the help of "Match Regular Expression" primitive for further help on regular expressions. Also you can look here in the forums since this is a regularily discussed topic and, sadly, not too easy to begin with....
Norbert
02-13-2013 10:12 AM
Mr Norbert_B,
Thank you, It's so kind of you
Could I have the vi file of your last programme ?
Best regards
02-13-2013 10:16 AM - edited 02-13-2013 10:17 AM
I dont like posting VIs on the forums since it is my experience that users simply use those examples as ready-to-go-solutions without analyzing the code...
Nevertheless, this is my one-per-year-exception.
Norbert
02-13-2013 10:37 AM
hhh tkank you very much, although I can't enjoy your program because i'm using juste the 2010 version.
It does not matter, I'll manage.
Have a nice day.
Cordially
02-14-2013 01:54 AM
In LV 2010 the VI would be a little more tricky since i use the conditional indexing tunnel which is a new feature to 2012.
Still, it is doable, but you have to process the result array in a more complicated way. Either you put only the valid filepaths into the array at all (requires shift register and build array function) or you put one entry in each iteration into the array and delete invalid entries in a postprocess. The later option works with an autoindexing tunnel, but requires you to differ between valid and invalid entries (similar to what i did). For invalid values, put an empty string into the autoindexing tunnel.
hope this helps,
Norbert
02-14-2013 10:50 AM
Hello dear Norbert,
Right now, I can't translate your propositions to vi programme. But I still searching until find solution;
Thanks
best regards.