Example Code

Counting Files with Specified Extension Type in a Directory Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

The example counts all the files in a specified directory with a specific file extension.

 

Description

The example counts all the files in a specified directory with a specific file extension, when you try to counts the number of specified file, use it!

 

Requirements

  • LabVIEW 2012( (or compatible)


Steps to Implement or Execute Code

  1. Specify the folder that you would like to search in the "Folder Path"
  2. Select the extension type that you would like to search
  3. Run the vi

Additional Information or References

Front Panel

FP.JPG

VI snippet

BD.png

 **This document has been updated to meet the current required format for the NI Code Exchange.** 

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
GregSands
Active Participant
Active Participant
on

A  better way to do this would be to use the "pattern" input on List Folder, so you only get a list of matching files, and then simply use Array Size to determine how many there are.  It will be much quicker, and use less memory as well.

Also, if you decide to use a For Loop, you should definitely only read the RingText once, not on every iteration.