Quick Links

Even though both Windows and its users have made the jump to the 21st century, there's still some lingering 1990s-era annoyances hiding out in the OS including Windows' tenacious desire to create thumbnail files (and then refusing to delete them). Read on as we solve the "File In Use" deletion error problem.

What's the Problem?

When you're tidying files, deleting older archives, or otherwise cleaning up after yourself it's not uncommon to run into  the very annoying "File In Use" error. The way the error crops up usually goes like this. You look at a folder, decide you no longer need said folder and its contents, but when you attempt to delete the folder you get an error message that looks like this.

Windows will happily delete the contents of the folder but it won't delete the folder and the "Thumbs.db" file will persist. You can click "Try Again" all day and it won't budge. Yet if you move on in frustration and sort and purge more folders you'll find that you can then return and delete the original folder and the pesky Thumbs.db file inside. What gives?

Windows has a very sensible policy that prevents the deletion of files currently in use by the operating system or an application. That's a great policy to have and, on its own, it rarely causes any issues. Unfortunately Windows also has another policy that all folders with visual media (image files and movies) should have a database of thumbnails to provide thumbnail images for the files if the user switches to any of the available thumbnail views.

When you open the folder to check the contents Windows loads the Thumbs.db file into Windows Explorer. When you go to delete the folder, Windows refuses because the Thumbs.db is currently in use by Explorer. The reason you can return to the stubborn folder later and delete it successfully is because  either enough time has elapsed and Windows has unloaded the Thumbs.db or since then you've loaded another folder and that folder's Thumbs.db replaces the previous Thumbs.db and now the original Thumbs.db is no longer locked by Windows and the annoying "File In Use" error vanishes. That's great but now the new Thumbs.db file is locked and the cycle of frustration continues.

Microsoft kind-of-sort-of fixed this issue in the transition between Windows XP and Windows Vista by shifting thumbnail creation on local drives to a centralized location. In Windows Vista (as well as Windows 7 and Windows 8) thumbnails are stored in a central database located at 

        %userprofile%\AppData\Local\Microsoft\Windows\Explorer
    

instead of in every individual folder. While that cleared up most deletion problems and decluttered user folders, the Thumbs.db problem persists to this day when working with network/remote drives and folders.

Let's look at several solutions, both temporary and permanent, you can use to banish this annoying error.

Fixing the Error

There are several ways you can work around the error that range from temporary solutions (so you many continue to use the thumbnail feature) to permanent ones (wherein you won't have to worry about the problem popping up again). We'll start with the temporary solutions, which are handy if you're using a work computer where you don't have the privileges to make changes.

Note: If you're having issues with the Thumbs.db in Windows XP, please refer to this tutorial for techniques on disabling thumbnails in XP; this tutorial is focused on the new thumbnail system found in Windows Vista and newer installations.

Temporarily Disable Thumbs.db Access

Windows only uses the thumbs database if you're browsing files in Windows Explorer with a view that requires Explorer to pull thumbnail data for display. Thus a very handy work around that's both temporary in the application sense (you don't have to disable system wide thumbnails) and the chronological sense (it persists only as long as you have a single non-permanent setting changed) is to switch your Windows Explorer view to "Details."

You can access it via File -> View -> Details or via the right-click context menu within the folder you're working. If you're doing a lot of work with many folders, you may wish to change the folder view across the entire system by navigating to File -> View -> Options and then in the Folder Options menu, selecting the View tab and then the "Apply to Folders" button to apply the view selection you made to all folders.

Now when you're sorting and purging your folders the thumbnail database file will remain unloaded and you can delete folders without interference. This solution is ideal if you actually want thumbnails for your remote drives but you don't want them in the way when you're doing serious folder management.

Disabling Network Thumbnail Creation

If the "File In Use" error is infuriating enough that you just want those irritating Thumbs.db files gone forever from your network drives, the best practice is to outright disable their creation. This will not stop Windows from creating and caching local thumbnails (such as those that would appear in your local photo libraries); those thumbnails will still be generated and stored in the centralized database we mentioned earlier in the article. It will disable all future thumbnail database creation on remote drives.

Via the Group Policy Editor

For users running versions of Windows Vista, Windows 7, and Windows 8 that have access to the Group Policy Editor (found only in editions above the Home Premium level like Windows 7 Professional and the like), you can disable network thumbnail generation through the policy editor.

Open the Local Group Policy Editor by typing "gpedit.msc" in the Start menu run box. In the policy editor navigate to following location, using the left hand navigation panel, based on your version of Windows.

Windows Vista and Windows 7 users should use navigate to User Configuration -> Administrative Templates -> Windows Components -> Windows Explorer.

Windows 8 users should navigate to User Configuration -> Administrative Templates -> Windows Components -> File Explorer.

Users of all three operating systems should then look in the right hand panel where the configuration settings are listed and sort the settings by name by clicking on the title of the Setting column as seen in the screenshot above. Look for the entry "Turn off caching of thumbnails in hidden thumbs.db files" and double click on it.

By default it is set to "Not Configured." Change it to "Enabled." Click OK to save the setting and then reboot your computer for it to take effect. Henceforth, Windows will no longer generate Thumbs.db files while browsing network drives.

Via the Registry Editor

For users without access to the policy editor, a registry hack is required to create the same effect. Be forewarned that playing in the Windows registry is serious business, and you should triple check every change you make before committing to it.

To access the registry editor type "regedit.exe" in the Start Menu run box and hit enter. Where the registry key is found varies based on your version of Windows.

Windows Vista and Windows 7 users need to navigate to the following registry key:

        HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer\
    

Within that key edit the REG_DWORD entry "DisableThumbsDBOnNetworkFolders" to the value "1" (the default is 0).

Windows 8 users have a trickier time of it as there is no matching key to be found in \Policies\Windows\. In order to enable the same value on Windows 8 you need to create both the missing key and the value. Navigate to this key.

        HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\
    

Right click on the \Windows\ key and select New -> Key. Name the new key "Explorer". Within the new key right click on the right navigation panel and select New -> DWORD. Name the DWORD entry DisableThumbsDBOnNetworkFolders. Right click on it and modify it to change the value from 0 to 1.

If you're not comfortable editing an existing value or creating a new value altogether, you can create a registry file by pasting the following text into Notepad as saving the file with a ".reg" instead of a ".txt" extension. Double click on the file to annotate the registry.

        Windows Registry Editor Version 5.00
    

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer]

"DisableThumbsDBOnNetworkFolders"=dword:00000001

This registry file will work for Windows Vista, Windows 7, and Windows 8.


With the above edits in place you'll no longer need to deal with finnicky Thumbs.db files on your network shares; cleaning and organizing your folders will be a smooth experience without the constant frustration of locked files.