November 05, 2002

An Enhanced Directory Utility

Run this script to empower your directory searches
RSS
View this exclusive article with VIP access -- click here to join |
See More VBScript Articles Here | Reprints | Or sign up for our VIP Monthly Pass!

File housekeeping is a seemingly never-ending task for network administrators. Removing temporary files, duplicate data, old service packs, blue-screen-of-death dumps, and unauthorized media files such as MP3s is repetitive and time-consuming. The Dir command, which you issue from a command prompt, is limited in its ability to query for anything more than filename information. You can use wildcards to list files (e.g., dir *.doc), but you can't specify date ranges or file sizes. Windows Explorer provides more flexible search capabilities but doesn't let you output the results to a text file or use scripts to automate searches (Windows Explorer requires human interaction, so you can't automate its features).

To help you perform regular administrative cleanup tasks, you need a command-line utility that can use a variety of criteria to perform directory search operations. I've written a script, edir.vbs, which Listing 1, page 2, shows, that lets you evaluate conditional expressions against files. Instead of wildcards or command-line switches, the Edir utility uses conditional expressions to filter files, so you can use complex criteria when searching. I developed the script under Windows 2000 Service Pack 2 (SP2) with Windows Script Host (WSH) 5.6. The script requires WSH 2.0 or later and VBScript 5.0 or later to execute. I've tested the script under Windows NT 4.0, and it will also run as is under Windows Me and Windows 9x. . . .

Top Viewed ArticlesView all articles
No Jobs, No Excitement at Apple's Last Macworld Keynote

Apple CEO Steve Jobs made the right move in skipping out on his company's last appearance at Macworld: In a Tuesday keynote address at the conference, Apple had no interesting new products to sell, opting instead to spend mind-numbing amounts of time on ...

Where is Microsoft NetMeeting in Windows XP?

...

The Memory-Optimization Hoax

Don't believe the hype. At best, RAM optimizers have no effect. At worst, they seriously degrade performance. ...


Related Events Storage Consolidation for Your Microsoft Applications: Reducing Cost and Complexity

Optimize your VMware Infrastructure with the New Releases from the Symantec Backup Exec Family

Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


SQL Server Magazine Office & SharePoint Pro Windows Dev Pro ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing