LKBEN10690: Howto find out which directories exceed a certain limit with command line tools

This article has not been checked!

LKB | Created: 02/04/2020 | Version: 0 | Language: EN | Rating: 0 | Outdated: False | Marked for deletion: False

Author: Wim Peeters - Keskon GmbH & Co. KG


You need to find out the sizes of certain directories


You do not have quotas but need some information


You can use the diruse command from windows to do the job. This command can deliver all the information you need when it comes to file and directory sizes.

To show some information for the e drive you can use:

diruse  /m /* e:\

This delivers: (part of the output)


         2.19      5  SUB-TOTAL: C:\WINDOWS\$NtUninstallQ828026$
         0.00      0  SUB-TOTAL: C:\WINDOWS\addins
         0.00      0  SUB-TOTAL: C:\WINDOWS\aim95
         4.96     10  SUB-TOTAL: C:\WINDOWS\AppPatch
       275.98    451  SUB-TOTAL: C:\WINDOWS\assembly
         1.99      9  SUB-TOTAL: C:\WINDOWS\cluster
         0.00      0  SUB-TOTAL: C:\WINDOWS\Config
         0.00      0  SUB-TOTAL: C:\WINDOWS\Connection Wizard
         0.00      3  SUB-TOTAL: C:\WINDOWS\CSC
         0.29    184  SUB-TOTAL: C:\WINDOWS\Cursors
         0.41      9  SUB-TOTAL: C:\WINDOWS\Debug
         3.16     15  SUB-TOTAL: C:\WINDOWS\Downloaded Program Files
       109.01      9  SUB-TOTAL: C:\WINDOWS\Driver Cache
         0.06      2  SUB-TOTAL: C:\WINDOWS\EHome


Here we mark the directory with more than 180 MB with an exclamation mark in the front!

diruse /m /Q:180 /* e:\

Show only the direcotories who exeed the limit (here 50 MB)

diruse /m /Q:50 /D /* e:\

Show the progress during scanning (I dont like this)

diruse /v /m /Q:50 /D /* e:\

Show all the directories over the size of 50 MB for a given fileserver (very interesting)

diruse /m /Q:50 /D /* \\Lubbysrv\users

For more information you can execute diruse /? which delivers the following:

DIRUSE displays a list of disk usage for a directory tree(s). Version 1.20

DIRUSE [/S | /V] [/M | /K | /B] [/C] [/,] [/Q:# [/L] [/A] [/D] [/O]] [/*] DIRS

/S      Specifies whether subdirectories are included in the output.
/V      Output progress reports while scanning subdirectories.  Ignored if /S is specified.
/M      Displays disk usage in megabytes.
/K      Displays disk usage in kilobytes.
/B      Displays disk usage in bytes (default).
/C      Use Compressed size instead of apparent size.
/,      Use thousand separator when displaying sizes.
/L      Output overflows to logfile .\DIRUSE.LOG.
/*      Uses the top-level directories residing in the specified DIRS
/Q:#    Mark directories that exceed the specified size (#) with a "!".
        (If /M or /K is not specified, then bytes is assumed.)
/A      Specifies that an alert is generated if specified sizes are exceeded.
        (The Alerter service must be running.)
/D      Displays only directories that exceed specified sizes.
/O      Specifies that subdirectories are not checked for specified size
DIRS    Specifies a list of the paths to check.

Note:   Parameters can be typed in any order. And the '-' symbol can be
        used in place of the '/' symbol.

        Also, if /Q is specified, then return code is ONE if any directories are found that
        exceed the specified sizes.  Otherwise the return code is ZERO.

Example: diruse /s /m /q:1.5 /l /* c:\users

About the Author

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux in different European countries and different European languages. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform where he is one of the most important contributors and the main developer.


The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!