LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

counting .png files in subfolders

Solved!
Go to solution

I have to search a folder and his subfolders for .png data(only in subfolder are files), when I find a png file I have to write the number of them in an array(for every folder one).

 

But somehow I am a bit lost here, can someone help me?

0 Kudos
Message 1 of 7
(2,929 Views)

Hi NoName,

 

where are you lost? What is your problem?

 

Comments:

- There's a function/VI in the file palette that determines the file suffix (like "png"), no need to do that "manually"

- Learn about using shift registers!

- You don't need that inner while loop!

- Please post a VI instead of an image. We cannot debug images…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,920 Views)

here is a test VI with an example Folder and subfolder

 

the Result in the Array needs to be: 9  3  5

0 Kudos
Message 3 of 7
(2,910 Views)
Solution
Accepted by NoName1771

Hi NoName,

 

solution without using a shift registers:

check.png

You still should learn LabVIEW basics…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(2,899 Views)

Thank you, yeah I am still in training, so shame on me Smiley Wink

0 Kudos
Message 5 of 7
(2,883 Views)

A lot of this can also be simplified to a single VI:

Get File Count.png

 

This does a recursive directory listing and returns all .png files in the directory - it also returns a count of the files amongst other things - you may find it easier to call this in each directory (as you want the number of files in each directory, rather than the overall number of files in total).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 6 of 7
(2,875 Views)

Sam is right: replace the inner FOR loop (including ListFolder and Sum) with RecursiveFileList…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(2,869 Views)