Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

July 11, 2006 12:00 AM

Short Shell Script Supplies Diruse.exe Arguments

Windows IT Pro
InstantDoc ID #50582
Rating: (0)
Downloads
50582.zip

Diruse.exe is a handy command-line tool when you want to quickly see how much disk space a directory is using. To use it, you type the Diruse command, its options, and one or more directory names. I found myself frequently typing the command

Diruse /, . 

The /, option tells the Diruse command to use thousands separators when displaying directory sizes. The period (.) tells the Diruse command to get the current directory's size.

Because I was typing this command fairly frequently, I created a commandshell script that initializes the Diruse command with the /, option and the current directory as defaults. The script also expands the period to the full name of the current directory. That way, the full directory name appears in the Diruse.exe's output. This script even uses a shorter command name—du instead of diruse—to boot.

Listing 2 shows my DU.cmd script. The script's logic and flow should be fairly easy to follow. You can easily change the default options for the Diruse command. You just need to modify line that callout A in Listing 2 shows. For example, if you want to use both the /* and /, options, you'd use this line instead:

Set ARGS=/* /, 

To see what options are available, check out Diruse.exe's online help. For this script, I used Diruse.exe from the Windows XP Service Pack 2 Support Tools (http://www.microsoft.com/downloads/details.aspx?FamilyId= 49AE8576-9BB9-4126-9761-BA8011FABF38).

When you launch DU.cmd, you don't need to specify a directory name or even a period if you want the size of the current directory. Alternatively, you can specify multiple directory names on the command line. If any of the directory names contain spaces, enclose them in quotes. (DU.cmd handles the quotes automatically.)

—Bill Stewart

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.