Example Program Drafts

Showing results for 
Search instead for 
Did you mean: 

Simple file search

by Member pande71@gmail.com ‎07-22-2010 06:35 AM - edited ‎01-30-2017 09:35 AM


This example searches whether a particular file exists in the search path.


Use this VI if you want to manually check if a file exists in a specific file path.  The VI gets an array of the files in the directory using List Folder.vi, and then searches that array for the file name.  If the file exists, it returns the full file path of the file and a Boolean true. Otherwise, it returns an empty file path and a Boolean false.

Steps to Implement or Execute Code

  1. Open the version of the example which works with your version of LabVIEW
  2. Enter a path for in the Directory Path control
  3. Enter a file name in the File Name to Search control 
  4. Run this example independently or as a SubVI
  5. See the results on the front

Requirements to Run


LabVIEW 8.6 or higher



Additional Images

Block Diagram

File Search.png

Trusted Enthusiast Trusted Enthusiast
Trusted Enthusiast

One thing to notice is that this specific solution only works on Windows. due to the usage of the '\' in the append string.

Active Participant Himanshu_Goyal
Active Participant


The function List Folder will give you the folder and file list of directory path, if the file is available in any folder this function will not work and your code will not be able to get and directory path hierarchy. I think you should replace Folder List function with Recursive file list to get access of complete hierarchy and then you can search file in result list.........:-)

Trusted Enthusiast Trusted Enthusiast
Trusted Enthusiast

What does this VI do that the LabVIEW function 'Check if file or folder exists' doesn't do?


Member D*

Yes, use "Check if file or folder exists".  If you really want to search, then the Recursive file list is best, especially when using the filename as the "pattern" input to that .vi.