In-Depth

Take Back Your Time

Three new Resource Kit tools can reduce repetitive typing and perform scheduled file copying for you at night.

This month I continue my study of new utilities in the Microsoft Windows NT Server 4.0 Resource Kit Supplement 4. You may recall that last month I wrote about this latest supplement and how it’s just chock-full of brand new tools that you can’t live without. This month, let’s look at three very compact yet eminently useful utilities new to Supplement 4.

Mcopy.exe

As administrators, our jobs include many tedious tasks that must be accomplished daily. Backing up data is by far one of the most important (but still tedious) of our daily duties. Sometimes this consists of using NT Backup to save our entire hard drive to disk. Sometimes it simply means copying the files from one machine to another (an oft-employed method for those of us who still don’t own a DAT drive).

Microsoft Windows NT Server 4.0 Resource Kit Supplement 4
Microsoft Press
ISBN 0-73560-837-7
$49.99

If you’re scripting this “backup” to take place overnight, then Mcopy.exe might just be the tool for you. What does it do? It copies a single file from one place to another. That’s it! Why use it? Well, for one thing, if the file you’re backing up is, say, an Access .MDB, then you’re probably only backing up one file. You may say, “So what? The DOS COPY command lets me do that, and it’ll back up multiple files with wildcards, if necessary.” Yeah, but will it save the copy information into a log file? Nope. Mcopy does. In fact, each time it logs activity, it appends the copy information to the specified log file rather than overwriting it. This means you can keep a running log of copy procedures.

The syntax is:

MCOPY logfile sourcefile destfile

If you still say, “Sorry, Chris, but I’ve got to copy multiple files, so Mcopy is no good to me,” fair enough. I’ve got something for you, too…

MTC.exe

MTC, like Mcopy, logs its activity to a file—even the same one as Mcopy, if you prefer. The difference is that MTC lets you copy files from an entire subdirectory. The syntax is the same as Mcopy except that the filename isn’t specified:

MTC logfile sourcedir destdir

Mcopy or MTC?

The downside to both utilities is that you can only copy either a single file at a time (Mcopy) or a single directory (along with all of its subdirectories—MTC). Wildcards aren’t permitted, but both utilities let you specify copying only files newer than a particular date by using the—ddmmyy flag. So… Is this the greatest thing since sliced bread? Probably not. Will it replace the COPY utility for all of your file management needs? Definitely not! For critical, scheduled copy functions for which you need a log file to verify that they occurred, however, MTC and Mcopy may prove very useful.

Cliptray.exe

Sometimes the tedious administrative tasks I’ve just mentioned involve working with lots of different snippets of text. For instance, let’s assume you’re writing a script to use both MCT and Mcopy to copy trees and files from different directories to different directories, but using the same log file (which just happens to be located on a network share called S:\Public\Marketing\Admin\Chrisb\MyFiles\MyLogFiles\MyCopyLogs.txt). The parent directories of our source files and destination files are equally long.

Windows comes with a Clipboard where we can store just about anything—one thing at a time. To do the above task using the Windows Clipboard, we’d either have to decide which snippet of text we hated typing the most and copy it to the Clipboard, or place each snippet into a text file and drag and drop it every time we needed it.

Cliptray gives us access to any number of text snippets at any time (up to 100 per collection). Figure 1 shows how it looks. It runs in the system tray (you know, that area beside your clock) and references each text snippet based on a name that you give it. For example, I could name the full path to the log file “log,” the starting path of the source files “src,” and the starting path of the destination “dest” (which, coincidentally, is exactly what I’ve done). When I’m writing my script, all I have to do is right-click the Cliptray icon, select the snippet I need, and paste it.

Figure 1. Cliptray lets you access any number of text snippets at any time (up to 100 per collection). It runs in the system tray and refeerences each text snippet based on a name that you give it..

One of Cliptray’s best features is that it saves your snippets to disk, so you don’t have to reprogram in your text every time you reboot. You can create several files, each containing the collection of snippets that are needed for the current task. It even has a Preview mode, which you can use to view the text before you paste it (to make sure that you chose the right item—this saves a lot of “backspacing”).

Granted, I’d only want to use this for large amounts of text that I’m constantly reusing. If I put every single little phrase into Cliptray, I’ll spend more time searching through the list and pasting than I would typing it to begin with. Nonetheless, most scripts contain lots of big chunks of repeated text. In these cases, Cliptray shines.

I read somewhere about a study concluding that one of the major causes of stress wasn’t lack of money, but lack of time. It always seems that there just aren’t enough hours in the day. By using MTC and Mcopy to perform file copying at night and Cliptray to cut down on repetitive typing, you just might find yourself getting some of that time back. And if you have any to spare, could you lend me some? I’m a little short right now.

About the Author

Chris Brooke, MCSE, is a contributing editor for Redmond magazine and director of enterprise technology for ComponentSource. He specializes in development, integration services and network/Internet administration. Send questions or your favorite scripts to chrisb@componentsource.com.

Featured

comments powered by Disqus

Subscribe on YouTube