Slow Enumeration of files and subfolders by Windows Explorer

5.Jun.2010 | by Gusac | Filed in: Articles, Troubleshoot

Delay while accessing or opening a local folder with large number of files are quite common. There are times when Explorer just freeze there for couple of minutes before opening. It seems to be hung! However, it is acutally enumerating and preparing the view list of the files in it. There are few tweaks and steps which can improve the performance but I do not guarantee the total success of it. Moreover, if you have millions of files and subfolders, do expect explorer to take some time!

Few steps that we can try:

1. Disabling the shell extensions

Explorer or shell has few extensions or hooks into it, which provide added functionality. Shell extension handlers are queried by the shell beforehand for modifying the action the shell takes. They can be associated on a per-file type basis - where they will show up only when a particular action takes place on a particular file type - or on a global basis - which are always available. Check the Wikipedia page

So, we can go ahead and disable them to turn off those features and test. For that we need a utility called ShellExView. Its a small and neat utility which list all the Microsoft and non-Microsoft shell extensions installed on the box. All you  have to do, right click and enable/disable them. Click here to go to the download page.

Once you downlod the utility, simply run the executable and it will present the long list of extensions. Some of them are default ones, which come with Windows, like In-search pane, New (context menu), Library (Win 7) etc.  I would recommend to sort the list as per 'Company name' and disable the non-Microsoft extensions. All you have to do is highlight them and right click > Disable.

  click to see the large image

Just make sure, since you  have started with company name, there will few extension listed at the top (company name starting before 'M') and few at the bottom (after 'M').

Note: It is important to kill the explorer.exe and reload it to test. Once you disable and reload the Explorer.exe. Try accessing the folder again.

2. Disable realtime protection by antivirus, anti-malware or any other software

As tghere behavior is, antivirus or anti-malware software scan each and every file folder you access. So if you have a folder with huge number of files, its going to take some time to scan them. Best way to disable the real time scanning and/or disable the associated services and test.

3. Disabling non-essential services and start up items

By that, I mean try safe mode. Because in safe mode all the start up items, non-essential services & drivers (including Windows and non-Windows) are disabled. So, if anyone of that is causing the issue, it is the best way to narrow down. If safe mode fixes the issue, we can try msconfig to disable only the services and startup items and boot in normal mode (drivers would still be loading).

4. Registry tweaks related to NT File System (NTFS)

NTFS has few registry entries which depicts how the file system works and what things it keeps in mind everytime the file structure is accessed. We can disable few of the features to reduce the 'overhead' and hence improving  the performance. Where we have hundreds and million of files to be enumerated, this feature can be an overhead keeping the performance in mind.  Few of them are:

NTFSDisableLastAccessUpdate: Disables last accessed timestamp of a file. By default NTFS updates the date and time stamp of the last access on directories whenever it traverses the directory. Go to the following registry and change the value to 1. (DISABLE Last Access Update)

Location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
NValue name: NtfsDisableLastAccessUpdate
Value Type: REG_DWORD
Value Data: 1

FolderContentsInfoTip:
Location: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
Value Name: FolderContentsInfoTip
Value Type: REG_DWORD
Value Data: 0

InfoCacheLevel:
Location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRxSmb\Parameters
Value Name: InfoCacheLevel
Value Data: REG_DWORD
Value Data: 10 (Hexadecimal)

5. Change the folder view

Folder view setting has a lot to do. If thumbnails or details options are selected. Its going to take a long time Moreover, we also do away with any other customization. If it is not possible to open the folder, then you can change setting on another folder and use that as a template. Check the Microsoft KB Article: 812003

I would recommend to use the list view for the folder and then try accessing it. It makes the enumeration faster.

6. Desktop.ini

Windows may also store customization information in a hidden Desktop.ini file in the folder. In this case, Windows sets the read-only attribute on the folder to instruct Windows to look for the Desktop.ini file. The

Open command prompt and browse the folder we are trying to access. Once we are there, run the following commad to remove the attributes off the Desktop.ini file

> attrib -r -h -s desktop.ini

(REF: http://support.microsoft.com/kb/326549/)

Once you remove the attrib, open the desktop.ini and delete it. Make sure we make the default view size of folder to LIST VIEW.