I have a couple of folders on an NAS storage device which have been emptied of data and I would like to remove them. When attempting to delete them, I get an error message saying "The action can't be completed because the folder or a file in it is open in another program".

Both folders are empty. I have enabled the Show hidden files, folder or drives in the Explorer View options and the folders are still empty. I have used Beyond Compare to view the folder contents and the folders are still empty. I have searched the folders using Process Explorer and Lock Hunter to try and free them up but they have both found no locking processes.

I need these gone, what can I do now?

EDIT: I can connect to the NetApp via SSH

  • 1
    @RichM - Since you have indicated the file server is used 24/7 are you able to SSH into the NAS? Edit your question, instead of submitting a comment, and include this vital information. – Ramhound Nov 13 '19 at 15:01

The folder is locked by something, but you can't find out what. or where the lock comes from.

Given that the folder is located on a NAS, the easiest solution is to simply reboot the NAS to remove the lock, and immediately after remove the folder.

If possible, it is advised to use the web interface of the NAS to remove the folder, to prevent your explorer to set a lock to the folder preventing you from deleting the folder after the reboot. (I know this is not possible in your case, but others who stumble upon this question and answer may have that ability)

Even in a business environment with many people using the NAS, there always is a moment where you can perform a maintenance reboot. Usually everyone leaves after hours, so the action can be performed then. If people work even after hours, then schedule the reboot, and announce it company wide that the NAS will be rebooted for maintenance. Usually lunch time is a moment when this can be done, otherwise after hours is another option.

Tell them to close all files to prevent losing data and just reboot the NAS. People who still had files open but were warned only have to blame themselves.

  • 2
    This answer absolutely does not warrant a downvote, since it absolutely is a valid solution to the problem, of a lock file on a file server. – Ramhound Nov 13 '19 at 14:58
  • As it turns out in this instance, rebooting the NetApp would not have resolved this problem as the shares are persistent. We had to remove the (sub)share from the NetApp before we could delete the folder. – Rich M Nov 20 '19 at 9:02
  • @RichM I've read your solution. I'm pretty sure rebooting would have worked also. But I'm glad you figured it out nevertheless. – LPChip Nov 20 '19 at 12:20

Have finally resolved this enigma. The problematic sub-folders were being shared specifically on the NetApp, along with the root share. Removing the "sub" share from the NetApp allowed the folders to be deleted.

Open NetApp OnCommand Manager and browse to the relevant controller.
Expand the Storage node.
Click on the Shares node.
Find the relevant share in the right-hand pane.
Right-click on the share and select "Stop sharing".
Confirm your selection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.