Windows Tools

DirUse Examples

Overview | Syntax | Examples | Related Tools Open Command Prompt

Example 1: List Current File Usage for a Shared Volume

In your company, users store their files on a shared volume called \\shared. The \\shared\data folder is broken down into folders for each department. Each department folder is broken down into folders for users from that department as well as one or more folders that are shared by all users in that department. The \\shared\data folder also has one folder — \\shared\data\common — that is used to share information between departments.

You have been asked to generate a report that shows the current usage for the network volume where users in your company store their data. This report must show the usage by department and list any individual user who has more than 50 MB of data on the volume. To generate the data for the first part of your report, type the following at the command line:

diruse /* /m \\shared\data > c:\deptdata.txt

This generates a list of usage in megabytes of the top-level folders contained in the \\shared\data folder. The output is sent to the Deptdata.txt file on your C drive.

Looking at Deptdata.txt, you see the following output:

	Size (mb)  Files  Directory
	 248.60   3739  SUB-TOTAL: \\SHARED\DATA\Admin
		31.27	 36  SUB-TOTAL: \\SHARED\DATA\Common
	1448.14  23654  SUB-TOTAL: \\SHARED\DATA\ConsultServ
	 107.64	750  SUB-TOTAL: \\SHARED\DATA\CorpServ
	1053.28   6145  SUB-TOTAL: \\SHARED\DATA\Design
	 147.11	258  SUB-TOTAL: \\SHARED\DATA\Engrg
		70.56	745  SUB-TOTAL: \\SHARED\DATA\Finance
		18.78   1188  SUB-TOTAL: \\SHARED\DATA\Hardware
		12.18	 50  SUB-TOTAL: \\SHARED\DATA\HR
		 2.22	 23  SUB-TOTAL: \\SHARED\DATA\InfoTech
		 5.44	 46  SUB-TOTAL: \\SHARED\DATA\Legal
		18.53	 56  SUB-TOTAL: \\SHARED\DATA\ProdDev
	 470.43   2016  SUB-TOTAL: \\SHARED\DATA\ProdMktg
	 107.92   1445  SUB-TOTAL: \\SHARED\DATA\Research
		31.10	 43  SUB-TOTAL: \\SHARED\DATA\Sales
		 9.98	 14  SUB-TOTAL: \\SHARED\DATA\TechSupp
	 114.82   1269  SUB-TOTAL: \\SHARED\DATA\Training
	3898.00  41477  TOTAL

You can see in this output that only the Admin, ConsultServ, CorpServ, Design, Engrg, Finance, ProdMktg, Research, and Training departments have more than 50 MB of data each. To see what users have more than 50 MB of data stored on \\shared\data, type the following at the command line:

diruse /* /m /q:50 /d \\shared\data\admin, \\shared\data\consultserv, \\shared\data\corpserv, \\shared\data\design, \\shared\data\engrg, \\shared\data\finance, \\shared\data\prodmktg, \\shared\data\research, \\shared\data\training > c:\userdata.txt

This generates a list of the all top-level folders contained in any of the listed folders that use more than 50 MB of disk space. The output is sent to the Userdata.txt file on your C drive.

Looking at Userdata.txt, you see the following output:

Searching for directories that have exceeded 50 megabytes
	Size (mb)  Files  Directory
!	 68.30	697  SUB-TOTAL: \\SHARED\DATA\Finance\Jack
		70.55	744  TOTAL

You can see in this output that only one user, Jack, is marked as using more than 50 MB of data.

Example 2: Determine Compressed File and Folder Sizes

You want to compare the actual size of folders containing compressed files and the apparent uncompressed size in your Windows folders. To generate a list of top-level folders contained in the Windows folder with their associated compressed sizes, type the following at the command line:

diruse /c /* /m c:\Windows > c:\data\compressed.txt

The Compressed.txt file in the C:\Data folder contains the output from the command-line statement. The file contains the following output:

	Size (mb)  Files  Directory
		 0.00	0  SUB-TOTAL: C:\WINDOWS\addins
		 0.19	 64  SUB-TOTAL: C:\WINDOWS\Application Compatibility Scripts
		 1.56	7  SUB-TOTAL: C:\WINDOWS\AppPatch
		 2.52	 16  SUB-TOTAL: C:\WINDOWS\Cluster
		 0.00	0  SUB-TOTAL: C:\WINDOWS\Config
		 0.00	0  SUB-TOTAL: C:\WINDOWS\Connection Wizard
		 0.29	184  SUB-TOTAL: C:\WINDOWS\Cursors
		 0.03	5  SUB-TOTAL: C:\WINDOWS\Debug
		 0.00	3  SUB-TOTAL: C:\WINDOWS\Downloaded Program Files
		86.94	1  SUB-TOTAL: C:\WINDOWS\Driver Cache
		12.04	177  SUB-TOTAL: C:\WINDOWS\Fonts
		40.71   1536  SUB-TOTAL: C:\WINDOWS\Help
		 0.00	0  SUB-TOTAL: C:\WINDOWS\IIS Temporary Compressed Files
		 0.60	3  SUB-TOTAL: C:\WINDOWS\ime
		 0.00	0  SUB-TOTAL: C:\WINDOWS\ime (x86)
		41.86   1323  SUB-TOTAL: C:\WINDOWS\inf
		 1.71	 29  SUB-TOTAL: C:\WINDOWS\Installer
		10.96	 35  SUB-TOTAL: C:\WINDOWS\java
		 2.43	 40  SUB-TOTAL: C:\WINDOWS\Media
		29.36	137  SUB-TOTAL: C:\WINDOWS\Microsoft.NET
		 3.13	 30  SUB-TOTAL: C:\WINDOWS\msagent
		 0.00	0  SUB-TOTAL: C:\WINDOWS\msapps
		 0.00	0  SUB-TOTAL: C:\WINDOWS\mui
		 0.00	1  SUB-TOTAL: C:\WINDOWS\Offline Web Pages
		11.75	801  SUB-TOTAL: C:\WINDOWS\PCHEALTH
		 1.07	5  SUB-TOTAL: C:\WINDOWS\Registration
		11.62	 10  SUB-TOTAL: C:\WINDOWS\repair
		 0.00	1  SUB-TOTAL: C:\WINDOWS\Resource Pro Kit
		 2.01	4  SUB-TOTAL: C:\WINDOWS\Resources
		 9.48	 17  SUB-TOTAL: C:\WINDOWS\security
		 0.87	 25  SUB-TOTAL: C:\WINDOWS\system
	 677.42   5524  SUB-TOTAL: C:\WINDOWS\system32
		 0.00	1  SUB-TOTAL: C:\WINDOWS\TAPI
		 0.00	3  SUB-TOTAL: C:\WINDOWS\Tasks
		 0.02	1  SUB-TOTAL: C:\WINDOWS\Temp
		 0.00	1  SUB-TOTAL: C:\WINDOWS\twain_32
		 2.44	 90  SUB-TOTAL: C:\WINDOWS\Web
		 5.03	 16  SUB-TOTAL: C:\WINDOWS\WinSxS
	 956.01  10090  TOTAL

To generate a list of top-level folders contained in the Windows folder with their apparent sizes, type the following at the command line:

diruse /* /m c:\Windows > c:\data\uncompressed.txt

The Uncompressed.txt file in the C:\Data folder contains the output from the command-line statement. The file contains the following output:

	Size (mb)  Files  Directory
		 0.00	0  SUB-TOTAL: C:\WINDOWS\addins
		 0.19	 64  SUB-TOTAL: C:\WINDOWS\Application Compatibility Scripts
		 1.56	7  SUB-TOTAL: C:\WINDOWS\AppPatch
		 2.52	 16  SUB-TOTAL: C:\WINDOWS\Cluster
		 0.00	0  SUB-TOTAL: C:\WINDOWS\Config
		 0.00	0  SUB-TOTAL: C:\WINDOWS\Connection Wizard
		 0.29	184  SUB-TOTAL: C:\WINDOWS\Cursors
		 0.03	5  SUB-TOTAL: C:\WINDOWS\Debug
		 0.00	3  SUB-TOTAL: C:\WINDOWS\Downloaded Program Files
		86.94	1  SUB-TOTAL: C:\WINDOWS\Driver Cache
		12.04	177  SUB-TOTAL: C:\WINDOWS\Fonts
		40.71   1536  SUB-TOTAL: C:\WINDOWS\Help
		 0.00	0  SUB-TOTAL: C:\WINDOWS\IIS Temporary Compressed Files
		 0.60	3  SUB-TOTAL: C:\WINDOWS\ime
		 0.00	0  SUB-TOTAL: C:\WINDOWS\ime (x86)
		41.86   1323  SUB-TOTAL: C:\WINDOWS\inf
		 1.71	 29  SUB-TOTAL: C:\WINDOWS\Installer
		10.96	 35  SUB-TOTAL: C:\WINDOWS\java
		 2.43	 40  SUB-TOTAL: C:\WINDOWS\Media
		29.36	137  SUB-TOTAL: C:\WINDOWS\Microsoft.NET
		 3.13	 30  SUB-TOTAL: C:\WINDOWS\msagent
		 0.00	0  SUB-TOTAL: C:\WINDOWS\msapps
		 0.00	0  SUB-TOTAL: C:\WINDOWS\mui
		 0.00	1  SUB-TOTAL: C:\WINDOWS\Offline Web Pages
		11.75	801  SUB-TOTAL: C:\WINDOWS\PCHEALTH
		 1.07	5  SUB-TOTAL: C:\WINDOWS\Registration
		11.62	 10  SUB-TOTAL: C:\WINDOWS\repair
		 0.00	1  SUB-TOTAL: C:\WINDOWS\Resource Pro Kit
		 2.01	4  SUB-TOTAL: C:\WINDOWS\Resources
		 9.48	 17  SUB-TOTAL: C:\WINDOWS\security
		 0.87	 25  SUB-TOTAL: C:\WINDOWS\system
	 811.63   5524  SUB-TOTAL: C:\WINDOWS\system32
		 0.00	1  SUB-TOTAL: C:\WINDOWS\TAPI
		 0.00	3  SUB-TOTAL: C:\WINDOWS\Tasks
		 0.02	1  SUB-TOTAL: C:\WINDOWS\Temp
		 0.00	1  SUB-TOTAL: C:\WINDOWS\twain_32
		 2.44	 90  SUB-TOTAL: C:\WINDOWS\Web
		 5.03	 16  SUB-TOTAL: C:\WINDOWS\WinSxS
	1090.21  10090  TOTAL

When you compare the output, you see that the only folder that contains compressed files is C:\Windows\System32.

Example 3: Use DirUse in a Batch File

You want to gather directory and subdirectory information on drive X. You use a batch file so that the data generated by DirUse can be manipulated in Microsoft Excel. The sample batch file contains the following lines of code:

X:
cd\
diruse /s x:\ > drvdata.txt
c:
"\program files\microsoft office\office\excel.exe" x:\drvdata.txt

The /s parameter specifies that you want information about all subdirectories on drive X. The redirect symbol (>) redirects the output to a file called Drvdata.txt.

After DirUse writes the directory information to the text file, the batch file switches back to drive C and starts Microsoft Excel. The command-line argument of the file name causes Microsoft Excel to open Drvdata.txt when the application starts. If you plan to use the batch file frequently, you can create an Excel macro to sort, delete, or format the data.

To use this batch file, save the sample code in a file called Drvdata.bat and type the following at the command line:

drvdata