# File size and file count of many directories

**URL:** <https://boards.straightdope.com/t/file-size-and-file-count-of-many-directories/516074>\
**Category:** Factual Questions\
**Created:** [November 2, 2009, 6:09pm UTC](https://boards.straightdope.com/t/file-size-and-file-count-of-many-directories/516074 "2009-11-02T18:09:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Livardo](https://avatars.discourse-cdn.com/v4/letter/l/43a26b/32.png) [@Livardo](https://boards.straightdope.com/u/Livardo)\
**Post date:** [November 2, 2009, 6:09pm UTC](https://boards.straightdope.com/t/file-size-and-file-count-of-many-directories/516074/1 "2009-11-02T18:09:28Z")

</div>

I’m making an inventory of the directories in a couple of our servers here. At the root level, I need to determine the file count and total file size of each directory and all subdirectories. Right now I have to right click -\> properties on each of the folders to get this information.

Is there a way I can do this with Windows command line tools? If not, is there a program (preferably free) I can download?

Thanks!

---

<div class="post-metadata">

**Author:** ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)\
**Post date:** [November 2, 2009, 6:14pm UTC](https://boards.straightdope.com/t/file-size-and-file-count-of-many-directories/516074/2 "2009-11-02T18:14:12Z")

</div>

[WinDirStat](http://windirstat.info/). LOVE IT!

---

<div class="post-metadata">

**Author:** ![control-z](https://avatars.discourse-cdn.com/v4/letter/c/eada6e/32.png) [@control-z](https://boards.straightdope.com/u/control-z)\
**Post date:** [November 2, 2009, 8:47pm UTC](https://boards.straightdope.com/t/file-size-and-file-count-of-many-directories/516074/3 "2009-11-02T20:47:18Z")

</div>

Seconded. WinDirStat is a very useful, enlightening, and entertaining program.

---

<div class="post-metadata">

**Author:** ![J-P\_L](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/j-p_l/32/3156_2.png) [@J-P\_L](https://boards.straightdope.com/u/J-P_L)\
**Post date:** [November 2, 2009, 8:55pm UTC](https://boards.straightdope.com/t/file-size-and-file-count-of-many-directories/516074/4 "2009-11-02T20:55:48Z")

</div>

[TreeSize](http://www.jam-software.com/freeware/index.shtml) is another option

---

<div class="post-metadata">

**Author:** ![spinky](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@spinky](https://boards.straightdope.com/u/spinky)\
**Post date:** [November 2, 2009, 9:24pm UTC](https://boards.straightdope.com/t/file-size-and-file-count-of-many-directories/516074/5 "2009-11-02T21:24:52Z")

</div>

[Here’s](http://sdmbexample.nfshost.com/measuredir.bat) a script I wrote a while back to do exactly that (roughly similar to ‘du’ in unix if you’re familiar). Handy for just finding the top disk hogs with the “–largest \<n\>” argument. Also has the option to just look at the top directories in the specified target directory. For example:

“measuredir c:\windows --largest 10” produces:

```auto

5.04G c:\windows\
946.65M c:\windows\system32\
619.72M c:\windows\$hf_mig$\
567.69M c:\windows\ServicePackFiles\
564.70M c:\windows\ServicePackFiles\i386\
562.88M c:\windows\SoftwareDistribution\
553.41M c:\windows\SoftwareDistribution\Download\
447.00M c:\windows\$NtServicePackUninstall$\
397.00M c:\windows\assembly\
247.09M c:\windows\system32\dllcache\

```

whereas “measuredir c:\windows --largest 10 --toplevel” only shows the sizes of direct subdirectories of c:\windows:

```auto

946.65M c:\windows\system32\
619.72M c:\windows\$hf_mig$\
567.69M c:\windows\ServicePackFiles\
562.88M c:\windows\SoftwareDistribution\
447.00M c:\windows\$NtServicePackUninstall$\
397.00M c:\windows\assembly\
224.99M c:\windows\Microsoft.NET\
203.02M c:\windows\ie7updates\
165.34M c:\windows\Installer\
112.09M c:\windows\Driver Cache\

```

---

<div class="post-metadata">

**Author:** ![spinky](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@spinky](https://boards.straightdope.com/u/spinky)\
**Post date:** [November 2, 2009, 9:34pm UTC](https://boards.straightdope.com/t/file-size-and-file-count-of-many-directories/516074/6 "2009-11-02T21:34:03Z")

</div>

Doh! I just noticed you wanted the file count in the dirs, too. My script doesn’t do that, but it could be added pretty easily.

---

<div class="post-metadata">

**Author:** ![Livardo](https://avatars.discourse-cdn.com/v4/letter/l/43a26b/32.png) [@Livardo](https://boards.straightdope.com/u/Livardo)\
**Post date:** [November 2, 2009, 9:42pm UTC](https://boards.straightdope.com/t/file-size-and-file-count-of-many-directories/516074/7 "2009-11-02T21:42:57Z")

</div>

Thanks to all.

I also was going to write my own script but I thought I’d ask here first.

I tried the windirstat tool and it works great! thanks for all the suggestions.
