How does Explorer calculate the folder size information in the folder tooltip?


This information is accurate as of Windows 7; the algorithm may change for future versions of Windows. The information is being provided for the edification of computer network administrators, who are curious about random stuff like this since it can affect their network load.

When you hover over a folder, Explorer shows an infotip (a special type of tooltip) which contains information about the directory, and the information that concerns network administrators is the "Size". How does Explorer calculate the size?

Explorer calculates the size by performing a naïve recursive listing of the directory and adding up the sizes of all the files it finds. If the enumeration takes longer than three seconds, then Explorer gives up after three seconds and reports the size as "larger than X" where X was the size it managed to calculate so far.

If you don't want Explorer to do this calculation, you can disable it from the Folder Options control panel by unchecking the box labeled Display file size information in folder tips.

Comments (22)
  1. henke37 says:

    This is the second time this week we get to hear about a three second rule in the shell this week.

  2. Lockwood says:

    @henke37: If a dev drops food on the floor, it is good to eat if picked back up within 3 seconds.

    At a social gathering, if a dev stands up, the chair is available for reuse after 3 seconds.

    It is indeed a magic number.

  3. Paul says:

    Not nice if compounded, such as 3 seconds multiplied by the number of non-responsive processes. Also, I don't like the 30 second DDE timeout of ShellExecuteEx that can cause a 30 second delay when opening a hyperlink when processes are non-responsive. It should be 3 seconds ;) Perhaps there should be a constant value used globally for how patient the average used is. Right now it would be 3 seconds. We may have to change it to 2 seconds in the future. (I am being facetious).

  4. Danny says:

    Wanna bet anything that has to do with delay/time and so in Windows internals is a multiple of either 3 or 7? Very religious people there at Microsoft..and Google didn't believe it with their "don't be evil" motto. Bah, I want a Android for PC, to see their Ray stories about Android delays </rant>

  5. The infotip tells me C:Windows is "larger than 4.81 MB".

    Right-click | Properties tells me 4.4-4.5 GB (Size vs. Size on disk.)

  6. @Danny nah, not religious, we just like Mersenne primes

  7. Stefan Kanthakl says:

    | Not nice if compounded, such as 3 seconds multiplied by the number of non-responsive processes.

    Who wrote that the shell is non-responsive during the 3 seconds?

    JFTR: threads exist, every process can use many of them!

  8. alegr1 says:

    Now, if somebody could tell the Explorer developers that the total size of selected files in the folder can be calculated instantly without having to click on "More…" button…

  9. confused says:

    @alegr1 how? What 'More…' button?

  10. John says:

    Sadly the folder tips don't show on my machine for some reason.  File tips work fine.  Probably a busted shell extension or something.

  11. Grijan says:

    @confused: he talks about the "More…" button on the details pane in Windows 7. When you show a folder with more than just a few items (say, one or two dozens), or select more than a few items, Windows 7' Exporer doesn't show any info in the details pane. I think it's a good decision for metadata such as the EXIF picture date, which has to be extracted from each file, but it should work for filesystem metadata, such as file sizes and last modified date.

  12. Oliver Salzburg says:

    It's actually the most accurate estimation anywhere in Windows.

  13. Gunnery Sergeant Hartman says:

    I'm gonna give you three seconds; exactly three f*cking seconds!

  14. xp.client says:

    In XP, if it says "Larger than xx" than if I hover over another folder and hover over the first folder again, the size updates to show the newest calculated size. Or if I open Properties and let Explorer calculate the size, the size updates thereafter in the tooltip. In Windows 7, once it shows "Larger than xx", it keeps showing that no matter what you do. Just saying.

  15. Solider says:

    @xp.client but then it's a bit weird: the tooltip changes every time you hover over the button?

    I installed Folder Size on my XP machine (foldersize.sourceforge.net) but I only enable it when I need it, otherwise it tries to read the entire partition every time I open Explorer.

  16. xp.client says:

    @Solider, I use it too. :) But this article isn't about column handlers (which Vista murdered btw). Folder Size even has an option to run only on local disks, but MS wasn't happy with people being productive. Their opinion that Explorer isn't as responsive if column handlers are allowed to enlist dynamic info is forced on everyone which is why the inferior indexing based Property System replaced it with "simplified" capabilities.

  17. voo says:

    @xpclient Actually with my win7 version if I hover over the same folder again it also continues to update the size (just tested on a 40gb folder with lots of small files). It does not realize thought if I let it compute the correct size in the properties window.

  18. Anonymous says:

    @Oliver Salzburg

    Actually it vastly overestimates the amount of space of, say, Windows.

    It's based on a total is a byte count of all files, not the total byte count of every unique file ID in the dir.  If you have a directory with hardlinks (there are plenty in my example of Windows) it will count files twice or more.

  19. MRDucks says:

    @Soldier,there's a stand-alone application called FolderSizes (http://www.foldersizes.com) that does an amazing job with this stuff. Very smart tool. Not free, though.

  20. ThomasX says:

    Ahh, the old superstition that an incorrect information is better than no information…

  21. Jim says:

    MRDucks: if you want a basic program along the same idea, "TreeSize Free" works very well.

    (Apologies if I'm violating some rule about mentioning specific software.)

  22. Danny says:

    @Mauritius we just like Mersenne primes</quote>

    Awesome, lemme know when you gonna plan to use the 48th one

Comments are closed.

Skip to main content