Diruse.exe: Directory Disk Usage


This command-line tool displays directory size information, including compression information for NTFS volumes. You can use Diruse to determine the actual usage of space for compressed files and directories. You can also specify a maximum folder size. Diruse then marks any folders that exceed the specified limit and, if you choose, alerts you to the problem.

If you run Diruse while logged on as a member of the Administrators group, you can check the use of disk space in directories even if you do not have access rights to those directories.

Diruse is similar to du used in UNIX.

File Required

Diruse Topics


top

Diruse Syntax


DIRUSE {/s | /v} {/m | /k | /b} [/c] [/,] [/q:# [/l] [/a] [/d] [/o]] [/*] [DirList]

Where:

/s
includes subdirectories of the specified directories in the output.
/v
writes progress reports while scanning subdirectories. The /v is 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
uses compressed file size instead of apparent file size.
/,
displays the thousands separator (comma or period) in file sizes.
/q:#
marks directories that exceed the specified size (#) with an exclamation point (!). If /m (megabytes) or /k (kilobytes) is not specified, the size is assumed to be in bytes. If /q is specified and any directory is found that exceeds the specified size, then the return code is ONE. Otherwise the return code is ZERO.
The following switches can be used in conjunction with /q:
/l Writes overflows to the log file diruse.log in the current directory.
/a Specifies that an alert is generated if sizes specified by /q:# are exceeded. The Alerter service must be running, and the alert appears only when you are using Diruse.
/d Displays only directories that exceed specified sizes.
/o Specifies that subdirectories are not checked to see if they exceed the specified size.
/*
uses the top-level directories residing in the specified DirList.
DirList
specifies a list of directories to check. DirList is required. Use semicolons, commas, or spaces to separate multiple directories.

Notes


top

Using Diruse


The switch to use for compressed directories and files is /c, which causes Diruse to display the actual size of a compressed file or directory instead of apparent uncompressed size. For example, if your drive D is an NTFS volume, and you want to determine the disk space used (in megabytes) and the number of files in each directory, at the command line, type:

diruse /s /m /c d:

To see compression information for a file, open Windows Explorer, right-click the file, and then click Properties.

You can also use Diruse to get information about directory size and redirect it to a file. Windows Explorer allows you to determine the size of the first level of directories on a drive, but does not allow you to determine the overall size of directories and their subdirectories. For instance, a drive might contain 400 directories. Using Windows Explorer, you can right-click a folder and then click Properties to view that directory’s information, but there is no way to find out how much data is contained in each subdirectory. Using Diruse, you can find out the size of a particular directory or subdirectory.

In the following example, Diruse is used in the batch file Drvdata.bat to gather directory and subdirectory information from drive X. The purpose of using the batch file is to get the total file size of each directory and subdirectory for manipulation in a spreadsheet or database. 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 switch allows you to use Diruse to get information about all subdirectories on drive X. Use the redirect symbol (>) to redirect 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. At this point, you can create a macro to sort, delete, or format the data. To use this batch file, type the following at the command line:

drvdata