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: 

open all files in folder as path array

Hello,

 

I am trying to open a folder of jpeg images and save the path as an array so that I can manually display them and step through them. What is the easiest way to open a folder of images and save the images as a path array?

0 Kudos
Message 1 of 13
(22,085 Views)
Just use the List Folder function. That returns an array of filenames which you can then loop through and use Build Path to create a full path.
Message 2 of 13
(22,078 Views)

There is a List Folder function in the Advanced file palette.  It will list all files in a folder or the list can be filtered.  I use this in my 

Slide Show program.

 

Lynn 

0 Kudos
Message 3 of 13
(22,074 Views)

One of the LabVIEW functions is called "List Folder". This VI will return an array of files that match a specific pattern. You can use this to search for all files of a specific type. From here you can use "Build Path" to turn each of the filenames into the full path or just "String to Path" to convert all of the filenames into relative paths.

 

     Rob

0 Kudos
Message 4 of 13
(22,072 Views)

Hi I just did what you did in the example, but the loop outputs an array of file names rather than outputting one filename at a time. How do you make it output the names sequentially to the file path input? I can't wire the file path array to the file path input. 

0 Kudos
Message 5 of 13
(21,109 Views)

Hi,

 

It's not clear what you exactly mean. Check the attached vi if it is the one which you are looking for..

Regards,

 

Nitzz

(Kudos are always Welcome, Mark as a solution if it is the One;))

Message 6 of 13
(21,106 Views)

@MadScientist wrote:

Hi I just did what you did in the example, but the loop outputs an array of file names rather than outputting one filename at a time. How do you make it output the names sequentially to the file path input? I can't wire the file path array to the file path input. 


Place the Path input in a loop. 😉

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 7 of 13
(21,097 Views)

OK, I managed to fix the problem. My VI was already in a for loop. When I copied the example, I made a new loop inside the main loop for the path builder, which did not work. The image processing loop needed to run once for each image. I placed the list folder icon outside this image processing loop, and placed the build path icon inside it, this did the trick. Now I have run into unrelated problems to do with building a report file. 

0 Kudos
Message 8 of 13
(21,089 Views)

I know this is an older post, but I am trying to create this array of file paths/names and it completely populates the array with all my file names, but then a dialog box comes up asking me to select a file.  I don't know why it is coming up and I don't want it to.  Does anyone know what may be causing this and have a way to fix it?

 

Thanks.

 

 

EDIT: Actually nevermind... I figured it out. It was a rogue sub VI that was off screen that was causing the dialog.  Thanks though!

0 Kudos
Message 9 of 13
(20,704 Views)

i tried to run your vi but i keep getting an error message which says file is not a resource file. 

 
0 Kudos
Message 10 of 13
(15,003 Views)