Error 8 At Delete Function When Deleting a Folder

Updated Jun 19, 2020

Reported In

Software

  • LabVIEW

Issue Details

I am using LabVIEW Delete Function to programmatically delete an entire folder, as shown below:

The folder exists at the specified path and I have the privileges to access that folder (i.e., it is not read-only).
However, when running the VI I get the following error:

Error 8
Possible reason(s):
LabVIEW: File permission error. You do not have the correct permissions for the file

 

If I manually delete the files inside the folder, the LabVIEW VI runs without errors.
How can I solve the problem?
 

Solution

The error could be caused by having read-only files inside the folder you are trying to delete.
You can check and fix this problem by following these steps:
  1. access the folder you are trying to delete in Windows Explorer
  2. right-click the contained files and select Properties 
  3. in Attributes, ensure to uncheck Read-only
  4. click Apply and OK
You can also programmatically change file permissions of all the files before trying to delete the folder by calling Set Permissions Function. You can find an example below and also attached: