One of the subscribers has found an interesting peculiarity of Windows Explorer in Windows 7 when working with network shares. The problem was that right after copying or moving a directory in the share, the system refused to delete or rename it. You could only rename or delete this folder only after a certain time (1-5 minutes).
When trying to delete this network share, the following error appeared:
As it turned out, the matter was in Thumbs.db, the file containing thumbnails of images. Since XP, Windows has been able to create the cache containing thumbnails of images (and other file types) and store it in the hidden file Thumbs.db in each directory. Due to cache, the time to load and display thumbnail files in the Explorer is reduced. If the image cache is disabled, the system has to load image files and generate their thumbnails every time, which is resource consuming (especially in case of folders containing a lot of images).
However, as it turned out, there are cases (KB2025703 — Renaming a network folder in Windows 7 Explorer fails with “the action can’t be completed…”) when thumbs.db with the thumbnail cache prevents folders to be deleted or moved using Windows Explorer.
It seems, the system needs some time to generate the file containing thumbnail cache, and while this file is generated or updated, you can do nothing to its parent directory.
In this case, you can disable automatic generation of thumbs.db for network shares and drives.
How to Disable Thumbs.db Generation on Network Shares Using GPO
In order Windows Explorer not to create a hidden cache file Thumbs.db, you can use GPO.
The policies we need are located in the following section of GPO Editor:
- In Windows 7 (Vista): User Configuration -> Administrative Templates -> Windows Components -> Windows Explorer.
- In Windows 8 / Windows 10: User Configuration -> Administrative Templates -> Windows Components -> File Explorer
Find and enable the following policies:
- Turn off the display of thumbnails and only display icons on network folders
- Turn off caching of thumbnails in hidden thumbs.db files
- Turn off the display of thumbnails and only display icons
First of all, we are interested in the first policy, which prevents the Explorer from creating thumbs.db in network shares.
Now link this policy to the users OU and update it on the computers (gpupdate /force)
How to Disable Thumbs.db on Network Shares Using the Registry
In Home editions of Windows without the GPO Editor, you can disable the creation of hidden files thumbs.db using the Registry Editor (regedit.exe).
To do it, in HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\ create the new key Explorer (it already exists in Windows 7), and create a REG_DWORD parametr with the name DisableThumbsDBOnNetworkFolders and the value 1
The same operation can be done with a single command:
reg add "HKCU\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v DisableThumbsDBOnNetworkFolders /d 0x1 /t REG_DWORD /f
How to Delete Thumbs.db in All Folders
The existing files Thumbs.db are not automatically deleted after you enable the policy. You can recursively delete all Thumbs.db files on a separate disk or in a server directory using PowerShell.
Go to the folder you need:
Get the list of all files Thumbs.db:
Get-ChildItem -Path . -Include Thumbs.db -Recurse -Name -Force | Remove-Item –Force –WhatIF
Recursively delete these files:
Get-ChildItem -Path . -Include Thumbs.db -Recurse -Name -Force | Remove-Item –Force