Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2
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:
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:
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:
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:
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:
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 a Microsoft 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: