Click here to Skip to main content
15,867,453 members
Articles / Desktop Programming / ATL

Folder Size Information in the Windows Explorer Details View

Rate me:
Please Sign up or sign in to vote.
4.59/5 (76 votes)
18 Aug 2010CPOL2 min read 443.2K   13.8K   80   96
This code displays the folder size information in the Explorer's Details view.
Sample Image - DirSize.jpg

Introduction

In day to day life, when one wants to know the size of a folder, (s)he has to right click on the folder name and has to choose the Properties. Using this DLL, one can view the folder size as one of the columns of the Explorer as shown in the image. We also have the facility to sort according to the folder size. (I did not do anything to sort, it is done by Explorer. :))

This class implements the Shell interface called IColumnProvider. Using this interface, one can customize the Explorer's Details view. This class adds one more column to the Details view, which displays the consolidated folder size.

To build this project, you must install Microsoft Platform SDK, or click here [53.5 KB] to download SHLOBJ.h.

How to Use the DLL

Well, if you build the project, you need not do anything, since the IDE automatically registers the DLL. If demo project is downloaded, then unzip the DLL and register it using the command "regsvr32 <Path of the unzipped DLL>". E.g., Regsvr32 c:\DirSize.DLL, if the DLL is present in C:.

Scope for Further Improvements

This code can be modified to display the number of files/folders in the folder. Or maybe, you can pack two more classes to display columns for number of files and number of folders into the same DLL to do so.

Performance Issues

When the user selects the "Folder Size" item from the Explorer context menu, the Explorer starts calculating the folder size by traversing all the files and nested folders. First time, it might take some minutes depending upon the contents of the folder. But all the operations are done in the background (Explorer is smart enough!.. Ehh). So this won't stop you from traversing through other files.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
India India
He is a graduate, currently working as a Software Engineer in Bangalore, India. You can reach him at sharan34@yahoo.com

Comments and Discussions

 
GeneralRe: Suggestion... Pin
m_harriss23-May-04 0:14
m_harriss23-May-04 0:14 
GeneralRe: Suggestion... Pin
m_harriss23-May-04 6:55
m_harriss23-May-04 6:55 
GeneralRe: Suggestion... Pin
Anonymous22-Jul-04 10:46
Anonymous22-Jul-04 10:46 
GeneralNo extra Column after registering dll Pin
Sorri6-May-04 23:45
Sorri6-May-04 23:45 
GeneralRe: No extra Column after registering dll Pin
Sorri6-May-04 23:48
Sorri6-May-04 23:48 
GeneralRe: No extra Column after registering dll Pin
Mr. GD (Mr.Green)19-Sep-16 6:13
professionalMr. GD (Mr.Green)19-Sep-16 6:13 
Questionhow do I uninstall Pin
Anonymous23-Apr-04 6:14
Anonymous23-Apr-04 6:14 
AnswerRe: how do I uninstall Pin
Poojas29-Apr-04 9:38
Poojas29-Apr-04 9:38 
Go to Start/Run and type:

regsvr32 /u DirSize.DLL

If you put the .dll file in a folder somewhere then insert the folder name BEFORE the dirsize.dll.

Example: regsvr32 /u c:\dllfiles\DirSize.DLL

Pooja
GeneralRe: how do I uninstall Pin
Anonymous10-May-04 5:42
Anonymous10-May-04 5:42 
AnswerRe: how do I uninstall Pin
TrInAdOr26-Jul-05 5:13
TrInAdOr26-Jul-05 5:13 
GeneralWindows Explorer (Search Files &amp; Folders) Pin
Anonymous17-Apr-04 11:33
Anonymous17-Apr-04 11:33 
GeneralWindows 98 Pin
John T6-Apr-04 7:25
John T6-Apr-04 7:25 
GeneralRe: Windows 98 Pin
Sharan Basappa6-May-04 18:02
Sharan Basappa6-May-04 18:02 
GeneralRe: Windows 98 Pin
rchas9-Feb-05 15:35
rchas9-Feb-05 15:35 
GeneralError Code Pin
Diamondblack22-Mar-04 5:06
Diamondblack22-Mar-04 5:06 
QuestionHow to install... Pin
Rajparikh2-Feb-04 22:45
Rajparikh2-Feb-04 22:45 
AnswerRe: How to install... Pin
Sharan Basappa9-Feb-04 0:06
Sharan Basappa9-Feb-04 0:06 
GeneralRe: How to install... Pin
upcleecher16-Mar-04 7:04
upcleecher16-Mar-04 7:04 
GeneralRe: How to install... Pin
tricotalazan28-Mar-04 1:29
tricotalazan28-Mar-04 1:29 
GeneralSorting for size Pin
orcun colak6-Jan-04 16:20
orcun colak6-Jan-04 16:20 
GeneralRe: Sorting for size Pin
Sharan Basappa30-Jan-04 0:18
Sharan Basappa30-Jan-04 0:18 
GeneralRe: Sorting for size Pin
m_harriss23-May-04 7:29
m_harriss23-May-04 7:29 
GeneralRe: Sorting for size Pin
Anonymous2-Jun-04 16:44
Anonymous2-Jun-04 16:44 
GeneralRe: Sorting for size Pin
Sharan Basappa30-Jan-04 0:18
Sharan Basappa30-Jan-04 0:18 
GeneralWrong Calculation Pin
Parker776-Jan-04 5:29
Parker776-Jan-04 5:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.