From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to capture files in a directory

I would like to use LabVIEW be able to browse to a desired directory and click a button that would grab all filenames of VIs in that directory (and subdirectories if a checkbox is selected) and place all those filenames into an array.  I know how to do portions of this, but I'm not sure how to grab all the filenames.  Can anyone offer suggestions?
0 Kudos
Message 1 of 13
(3,206 Views)
List folder with a *.vi pattern.

LV 8 (.2?) has a recursive version

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 13
(3,202 Views)
It's your lucky day! Those file functions TonP listed aren't new, we may just have made them more exposed recently. You can find them at C:\Program Files\National Instruments\LabVIEW X.X\vi.lib\Utility\libraryn.llb.

Specifically, check out Recursive File List.vi. Hope this helps!
Jarrod S.
National Instruments
0 Kudos
Message 3 of 13
(3,177 Views)

Yes, Recursive File List.vi has shipped with LabVIEW since version 7.0.  In version 8.2, I added the "pattern" input and put it in the File I/O > Advanced File Functions subpalette, along with a few other nifty VIs.

Enjoy,
-D

Message 4 of 13
(3,173 Views)
I used Recursive File List.vi to list the files in the user-specified directory.  Now, I want to allow the user to highlite/check either individual/multiple files or check-all, and pass this array of files to another VI.
0 Kudos
Message 5 of 13
(3,131 Views)

The listbox function is perfect for this. If you have either 0 or more items or 1 or more items as the Selection Mode, then it will return an array that you can use with the Index Array function and the Item Names property node to get the selected values.

Message Edited by Dennis Knutson on 10-28-2006 11:33 AM

Message 6 of 13
(3,123 Views)
I had the output of the Recursive File going into my Listbox then I changed a few things and I get File I/O errors.  Before that, though, I was not having very good success using the property nodes for the listbox.  The Sel Mode didn't seem to allow me to select more than one item, and after a selection is made, how do I determine which items have been selected?
0 Kudos
Message 7 of 13
(3,091 Views)
You haven't changed the default selection mode of the list box. I can tell that because in the picture, the listbox is a scalar. Go to the diagram and right click on the listbox. Do you see an item called Selection Mode?
0 Kudos
Message 8 of 13
(3,065 Views)
In the snippet I had sent before, I removed the code where I was setting the Selection Mode (because I was getting errors).  I added it back in now and I see the error shown.  I'm also having a problem where I can't get the Path to allow me to select a folder (or any files for that matter).  The code gets as far as it does now because I hard coded a path into the Path control.
0 Kudos
Message 9 of 13
(3,042 Views)

Why are wiring a value of 38 into the property node? I'll admit that I don't have 8.0 or 8.2, but in previous versions, that's not even close to valid. Right click on the node and select Help for Selection Mode. It will list the valid values. You can't just make up a value to write to it. And do you really need to set it on the diagram. Can't you just set it once on the front panel?

As far as the front panel path control, do you have the Browse button enabled and if so, what do you have for the Browse Options?

0 Kudos
Message 10 of 13
(3,030 Views)