LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Recursive File List returning the input folder path in "All folders" output

Highlighted

Hi,

is there a reason why Recursive File List.vi is returning the input folder path in "All folders" output? I can see in the code that it is added at the beginning but I don't understand why. Documentation specifies that All folders output should contain all the subfolders. I'm asking because I found a bug in one of my programs caused by this unexpected behavior.

Lucian
CLA
0 Kudos
Message 1 of 3
(1,687 Views)
Highlighted

It isn't documented, so perhaps you could get a CAR from NI to update the documentation - but looking at the code for the VI it starts by adding the current folder to an array containing 'all folders'.

 

I couldn't explain the reasoning behind why it was done that way (you'd have to ask the guy who wrote it), but I think I can understand why it was done that way - I think it would look a bit weird if it returned files that were in the top level directory without returning the folder that contains them.

 

For example the output would be:
C:\LabVIEW Working Directory\Testing <----- top level folder
C:\LabVIEW Working Directory\Testing\Level Sensor.zip
C:\LabVIEW Working Directory\Testing\Level Sensor
C:\LabVIEW Working Directory\Testing\Level Sensor\Acquire Level Sensor Data.vi

etc.

 

I think this makes more sense than:
C:\LabVIEW Working Directory\Testing\Level Sensor.zip
C:\LabVIEW Working Directory\Testing\Level Sensor
C:\LabVIEW Working Directory\Testing\Level Sensor\Acquire Level Sensor Data.vi

 

If you were displaying the file list in a tree control, you'd probably want the top level folder so that you can add the files within it as a child item.


LabVIEW Champion, CLA, CLED, CTD
MediaMongrels Ltd. - NI Alliance Partner (blog)
0 Kudos
Message 2 of 3
(1,667 Views)
Highlighted

I was surprised by your observation, as I've successfully coded a number of recursive "Directory Tree Walking" algorithms, but then I noticed I didn't use Recursive File List, but rather used List Folder, which returns All Files and All Folders within the current Folder.  Put this inside a recursively-called Reentrant VI and you have a Directory Tree Walker.

 

Bob Schor

0 Kudos
Message 3 of 3
(1,647 Views)