LKBDE11370: Wie man die Größe von Verzeichnissen per Kommandozeile herausfindet


Die Größe eines Verzeichnisses (inkl. Unterverzeichnissen) wird in einer Kommandozeile benötigt


Die Verzeichnisgröße wird benötigt, es sind keine Quotas definiert


Dies kann mit dem Kommandozeilenbefehl \"DIRUSE\" aus dem Windows Resourcekit erledigt werden
Im Folgenden sind einige Beispiele (z.B. für das E: Laufwerk):

diruse  /m /* e:\\

Dies ergibt (gekürzt):
         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

Ein Verzeichnis mit über 180MB mit einem Ausrufezeichen markieren:
diruse /m /Q:180 /* e:\\

Nur Verzeichnisse mit mehr als 50MB anzeigen:
diruse /m /Q:50 /D /* e:\\

Nur Verzeichnisse mit mehr als 50MB anzeigen - für angegebene Fileserver(!):
\r\ndiruse /m /Q:50 /D /* \\\\Lubbysrv\\users

Alle Parameter bekommt man mit diruse /?

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


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!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

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. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.