Example Code

Delete Selected Files

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

Code that will enable you to programmatically erase a file from a folder.

 

Description

This VI will allow the user to decide if a file is deleted from the directory specified in directory path that matches what is specified in a pattern. The pattern matching this function performs is like that used in matching wildcards in DOS and UNIX file names. If you specify characters other than the question mark character (?) or the asterisk character (*), this function lists only files and directories that contain those characters. You can use the question mark character (?) to match any single character. You can use the asterisk character (*) to match any sequence
of one or more characters.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code
1. Enter the full path of the directory in which to search.
2. Enter a pattern to search for within the directory.
3. Run the VI.
4. Confirm or cancel the delete operation for each filename found.


Additional Information or References

Snippet.png

Regards,
Dan King

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