Tuesday, October 30, 2018

Unknown Error Deleting Files and Folders on Windows Server 2012R2 on a DFS Share

I had an issue where a couple of users were trying to delete a folder called collections. Typically this isn't a hard issue you hit the delete key and it's gone. However we have a bit of a mixed environment with Macs and some Linux workstation accessing an assortment of files and folders, not to mention we do have live thumbnails in our environment being used as well. So as you know that means issues with the thumbs.db hidden file.

What is thumbs.db file?

A thumbs.db file used to quickly display thumbnail images inside a given folder. It is a hidden file so you can't see the file unless you set Windows/File Explorer to show hidden files. Even then depending on the system that last access the .htaccess file you may not see it. Mac OS has a bad habit of writing bad .htaccess files on windows shares especially in a domain environment. They have gotten better over the years, but occasionally you do get a malformed one. A thumbs.db file can keep Windows from letting you delete a folder, change permissions or ownership of files in a directory because Windows is keeping the thumbs.db file open.


Typically if this were a windows problem you do the following
  1. Press Windows + C and Type Control Panel
  2. Click "Appearance and Personalization"
  3. Click "Folder Options"
  4. Open the "View" tab
  5. Uncheck "Display file icon on thumbnails"
  6. Click OK, and exit control panel. You should now be able to delete the folder and the thumbs.db file.

As you can tell from the beginning of my post this wasn't going to work, and it didn't.  My problem was a legacy file from 2015, it was not visible or accessible in Windows Explorer even with show hidden files and folders enabled. This file was causing failures for removing the folders and changing ownership and permissions from the folder root.

Error when trying to change security permission/ownership

Error trying to change ownership

For me I am well aware of this issue and the fix is easy, but you need a unix/linux system to connect to the share to remove the file.

Problem Thumbs.db File

You need to connect to the share folder with the linux/unix system.  I am using a Ubuntu 16.04 VM on Server 2016 to do this.  Go to File -> Connect To Server... -> then put in the name or ip of your server.

You will then be prompted for the username and password of the server (in this case it is just our domain login credentials)

List of Windows Shares
When you mount the share by default you can see all hidden files and folders.  When you go to the directory where your having the issue you can try delete the problem file.  If you have an issue move the problem file to another directory you create using your linux client.  When you do that Windows Explorer shouldn't have enough time to make the thumbs.db in use and you can then delete the folder.

Linux SMB View

This is how I typically get rid of problem files like this.  It is usually garbage left over and it is annoying but easy to fix, and you don't have to do this to often.

How to fix CURL call imporitng an RSS feed on a site blocking CURL calls

There is a 3rd party service provider that my organization uses called bibliocommons.  They have these nice book carousels.  However the car...