LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

searching a file in the disk

Solved!
Go to solution

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

0 Kudos
Message 1 of 18
(3,086 Views)

If you really want to do that in LabVIEW, you can with the OpenG VI List Dir Recursive :

 

Clipboard01.png

 

hope this helps


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

Epictetus

Antoine Chalons

Message 2 of 18
(3,057 Views)

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 3 of 18
(3,053 Views)

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

0 Kudos
Message 4 of 18
(3,042 Views)
Solution
Accepted by topic author za3im_ensa

You can use the recursive file list function to create an array of filenames. Then do a string search within this array:

 

FileFilter.PNG

 

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 5 of 18
(3,035 Views)

Mr ,

 

Thank you, It's so kind of you

 

Could I have the vi file of your last programme ?

 

 

Best regards

 

 

0 Kudos
Message 6 of 18
(3,020 Views)

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 18
(3,016 Views)

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

0 Kudos
Message 8 of 18
(3,005 Views)

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 9 of 18
(2,978 Views)

Hello dear Norbert,

 

Right now, I can't translate your propositions to vi programme. But I still searching until find solution;

 

Thanks

 

best regards.

0 Kudos
Message 10 of 18
(2,960 Views)