Example Code

Deleting a Folder and All of Its Contents Including SubFolders and Files in LabVIEW

Code and Documents

Attachment

概述

This example allows the user to select a parent directory and delete that directory, all of its subdirectories, and all of the files contained within those folders.

说明

Currently, the delete function in the File I/O->Advanced Palette will only delete a directory when it is completely empty.

This example drills down into the folder as far as it can go and then deletes that folder and all of it's contents. It uses shift registers to change the directory path for each iteration of the loop. It then works its way up the tree deleting each folder until it reaches and deletes the parent folder.

硬件和软件要求

LabVIEW NXG 1.0 or compatible

实现或执行代码所需的步骤

1. Select specific directory in the directory path control.
2. Run the VI.
3. Confirm the deletion.
4. Click stop to stop the VI.

其他信息或参考

WARNING: This example deletes all of the contents from the folder that you specify in the directory path control above. Make sure you
do not select a folder that contains important documents or subfolders.

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

Contributors