Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated

Why Do I Receive Error 6 Occurred at Delete When Deleting a Folder?



Primary Software:
Primary Software Version: 2012 SP1
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
When trying to delete a folder using the Delete function, I am receiving the following error: 



My file path is correct. Why am I getting this error? 


Solution:
For LabVIEW 2012 SP1 and later:
This error typically occurs when the folder is populated. The Delete function has an entire hierarchy input that defaults to False, and this error will arise if the folder is not empty.

To resolve this issue, you must wire a True constant to the entire hierarchy input of the Delete function, as you can see in the VI Snippet below.

 
 

This will allow you to remove the folder and its contents. Do proceed with caution; the Delete function will not move the files to Recycle Bin. Once deleted, the files will not be recoverable. 


For LabVIEW 7.1 and earlier:
The Delete VI will not delete a populated directory. The VI will return an error if the directory is not empty. Therefore, the directory should either be emptied manually, or the List VI can be used to go through the directory and find all of the files and subdirectories. These files and subdirectories can then be deleted along with the highest-level directory. Please see the attached example for more details. 


If this does not resolve your issue, please look in the related links for other potential solutions.


Related Links:
KnowledgeBase 158774BS: Error 8 When Using Delete File Function in LabVIEW
KnowledgeBase 5V3KFEYJ: LabVIEW Error 6 – "Generic File I/O error"

Attachments:
Delete Fix.vi

deletedirall.vi


Report Date: 10/13/2005
Last Updated: 02/29/2016
Document ID: 3QCDOKIZ

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit