Click here to Skip to main content
15,881,715 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.1K   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

 
SuggestionNot working on Win10 - 64bit Pin
Member 139712013-Sep-18 3:21
Member 139712013-Sep-18 3:21 
GeneralRe: Not working on Win10 - 64bit Pin
bifeldy11-Dec-22 23:42
bifeldy11-Dec-22 23:42 
Questioni dont know what im doing Pin
Antonio T. Fernandez14-Mar-18 1:06
Antonio T. Fernandez14-Mar-18 1:06 
QuestionWho the 'F#$@' is Alice Pin
Member 115552837-Nov-17 2:42
professionalMember 115552837-Nov-17 2:42 
GeneralCool song names Pin
Member 115552837-Nov-17 2:40
professionalMember 115552837-Nov-17 2:40 
GeneralMy vote of 1 Pin
Member 1254146323-May-16 9:50
Member 1254146323-May-16 9:50 
QuestionFolder Size workink but no sorting correct by Folder Size Pin
vmix28-Apr-15 2:18
vmix28-Apr-15 2:18 
Hi All!

When you click on Folder Size for sort you can see

46 Bytes
48 KB
49 MB
50 KB
52 Bytes
..

just need display in Bytes and nothing more!
Questiongood code Pin
Member 102766607-Apr-14 23:40
Member 102766607-Apr-14 23:40 
GeneralMy vote of 5 Pin
Michael Haephrati20-Feb-13 5:07
professionalMichael Haephrati20-Feb-13 5:07 
QuestionFolder Size working but Ascending and Descending order not working! Pin
Aniljpatil2-Dec-11 21:56
Aniljpatil2-Dec-11 21:56 
QuestionThanks! - Folder Size is what I was looking for. Pin
ww dd19-Oct-11 6:29
ww dd19-Oct-11 6:29 
GeneralGood Job! Pin
omzig2-Sep-11 6:03
omzig2-Sep-11 6:03 
Questionadd a column for file/path length in windows explorer Pin
Member 435848925-Aug-11 11:32
Member 435848925-Aug-11 11:32 
GeneralMany Thanks!!! Pin
Member 791160310-May-11 2:14
Member 791160310-May-11 2:14 
GeneralNew DLL uploaded Pin
Sharan Basappa18-Aug-10 17:55
Sharan Basappa18-Aug-10 17:55 
GeneralBoth downloads contain the DirSize.dll but no code Pin
Thomas Schedl16-Aug-10 22:50
Thomas Schedl16-Aug-10 22:50 
GeneralRe: Both downloads contain the DirSize.dll but no code Pin
Sharan Basappa17-Aug-10 2:01
Sharan Basappa17-Aug-10 2:01 
GeneralNew DLL to show SIZE in MBs KBs and Bytes and number of Files and folders is uploaded. Pin
Sharan Basappa15-Aug-10 20:19
Sharan Basappa15-Aug-10 20:19 
GeneralGreat code doesn't work on XP x64 Pin
dband12-Apr-09 19:32
dband12-Apr-09 19:32 
QuestionHow to get Foldersize? Pin
tallapareddy23-Jul-08 20:42
tallapareddy23-Jul-08 20:42 
AnswerRe: How to get Foldersize? Pin
9ijnbhu87ygv14-Jun-09 0:35
9ijnbhu87ygv14-Jun-09 0:35 
Questionleft click /selection on the file / folder for the path Pin
techbie2-Aug-07 0:51
techbie2-Aug-07 0:51 
GeneralUsing Scripting.FileSystemObject Pin
clharidon5-Jun-07 23:54
clharidon5-Jun-07 23:54 
QuestionVista support? Pin
jordanbowness5-Mar-07 7:34
jordanbowness5-Mar-07 7:34 
AnswerRe: Vista support? Pin
alpdoruk20-Mar-07 20:49
alpdoruk20-Mar-07 20:49 

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.