Click here to Skip to main content
15,884,176 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 444.4K   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: Vista support? Pin
Vikrant for VC++1-Apr-07 23:33
Vikrant for VC++1-Apr-07 23:33 
GeneralRe: Vista support? Pin
yarp12-Apr-07 21:03
yarp12-Apr-07 21:03 
AnswerRe: Vista support? Pin
m78787816-Nov-07 6:40
m78787816-Nov-07 6:40 
GeneralFolder size in MB Pin
Kala Kasba30-Nov-06 7:33
Kala Kasba30-Nov-06 7:33 
GeneralFor newbies Pin
ezekiel6544-May-05 8:55
ezekiel6544-May-05 8:55 
GeneralRe: For newbies Pin
pinkmoon30-Jun-05 11:21
pinkmoon30-Jun-05 11:21 
GeneralRe: For newbies Pin
brio133730-Jun-05 13:25
brio133730-Jun-05 13:25 
GeneralRe: For newbies Pin
Sharan Basappa15-Aug-10 22:22
Sharan Basappa15-Aug-10 22:22 
Hi, New DLL is uploaded.
Generalcommas Pin
Member 147384127-Oct-04 6:16
Member 147384127-Oct-04 6:16 
GeneralRe: commas Pin
Xun Ding4-May-05 9:33
Xun Ding4-May-05 9:33 
GeneralRe: commas Pin
Xun Ding4-May-05 9:35
Xun Ding4-May-05 9:35 
GeneralThanks! Pin
fuckmeplease22-Oct-04 18:09
fuckmeplease22-Oct-04 18:09 
Generalit would be more perfect if you correct just one line~ :) Pin
cutepsy28-Jul-04 22:02
susscutepsy28-Jul-04 22:02 
GeneralShow size in MB Pin
wilkinsonrayo26-May-04 9:29
wilkinsonrayo26-May-04 9:29 
GeneralRe: Show size in MB Pin
Z372131-May-04 2:53
Z372131-May-04 2:53 
GeneralRe: Show size in MB Pin
Spoony21-Aug-04 10:44
Spoony21-Aug-04 10:44 
GeneralRe: Show size in MB Pin
Jac7513-Oct-04 13:00
Jac7513-Oct-04 13:00 
GeneralRe: Show size in MB Pin
Ayaz Awan3-Oct-06 0:29
Ayaz Awan3-Oct-06 0:29 
GeneralRe: Show size in MB Pin
Axel Rietschin16-May-07 6:17
professionalAxel Rietschin16-May-07 6:17 
GeneralRe: Show size in MB Pin
perottol8-Jun-04 2:42
perottol8-Jun-04 2:42 
GeneralRe: Show size in MB Pin
MXX26-Dec-04 18:47
MXX26-Dec-04 18:47 
GeneralRe: Show size in MB Pin
schanka25-Feb-05 3:53
schanka25-Feb-05 3:53 
GeneralRe: Show size in MB Pin
ho0chieman28-Feb-05 13:34
ho0chieman28-Feb-05 13:34 
QuestionRe: Show size in MB Pin
Lonesan15-Jun-07 15:02
Lonesan15-Jun-07 15:02 
GeneralRe: Show size in MB Pin
robaxn16-Jul-05 23:27
robaxn16-Jul-05 23:27 

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.