February 20, 2002

By Karen Kenworthy

IN THIS ISSUE

Aren't babies a joy? Lovely Monica, who used to create order out of chaos here at the secluded Power Tools workshop, and her handsome husband, young Bill, are head over heels in love with their new baby. Little Will, not quite 5 months old, is already wearing clothes meant for children twice his age. He can roll over, laughs and "talks" all the time. He's even experimenting with baby food!

Karen's Baby Grows Up

There's no doubt about it. Will is a delight. But I'm not jealous. As you may remember, I have a new baby too. :)

Not as adorable as Will, my baby has also been growing rapidly. And it seems like every day my baby learns a new trick or two. Best of all, my baby doesn't spit up, or ever need new diapers.

Of course, my baby is a computer program: the newest Power Tool, the Replicator. Born just last month as a simple program that duplicates files and folders on a regular schedule, it has already been revised and enhanced more than half a dozen times. Yes, believe it or not, my little one is already up to version 1.7!

The last time we got together, the Replicator had already been improved a couple of times. One early feature allowed the program to run unattended, with no human present to answer its questions.

For example, suppose the Replicator is run, and notices that a job is past due. What should it do? Run the past due job now? Or wait until the job's next scheduled time?

As most of you know, the program displays a small dialog box listing our options. If none is selected for 20 seconds, the program stops waiting. In that case, early versions of the Replicator would always run past due jobs later, at its next regularly scheduled time.

But thanks to the suggestions of several readers, the Replicator has become more obedient, letting you decide what happens even when you're not around. Now, when the Replicator asks a question, there's a checkbox on the screen that let's you designate the answer you are about to give as the "default" answer. In the future, the program carries out your wishes, assuming this default answer when you're not there in person to give it your instructions.

Like most babies, the Replicator's "eyesight" is improving too. Since it was born, the Replicator could see and duplicate hidden files. It also copied those files' attributes, giving their copies the same Hidden, System and Read-Only settings as the originals.

Unfortunately, early versions of the program couldn't see hidden folders. If a folder was marked as hidden, it was overlooked by the Replicator. No copies were made of the hidden folder, or of the files it contained.

But the latest Replicator has 20/20 vision. Now hidden folders, and the files they contain, are copied just like their non-hidden brethren. The new Replicator also duplicates the attributes of each folder it copies.

As the Replicator has grown older, it's also become faster. The Replicator now uses low-level Windows API (Application Program Interface) functions to read and write data. It uses the same functions to detect missing files and folders. This has also made the Replicator work better with CD-RW drives, especially those that are freshly formatted and have an empty root folder.

Another recent change allows the Replicator to display log files more quickly. Originally, loading and displaying very large log files (larger that, say, 100 KB) could take several seconds. But now log files as large as 1 MB, or even more, can be displayed almost instantly!

Folder Overlap

Today, baby Will is very well-behaved. Not too surprising, considering his age. After all, how much trouble can you get into, spending your days eating and sleeping?

But it won't be long before this little guy will be crawling and walking. When that day comes, he'll be a one-baby wrecking crew. Or would be, but for one thing: Monica and Bill will teach their child right from wrong, safe from dangerous.

And when they do, I hope they follow my example. You see, I've already had perform this task with my "child" ...

As all who knew him will attest, the original Replicator was eager to please. He would gladly copy files and folders from any source, to any destination. Normally, this was exactly what its users' wanted. The sun was shining, and all was well.

But what if, once upon a time, a source and destination folder overlapped? What if the destination folder resided within the source folder? For example, suppose the Replicator were asked to copy C:\, and its subfolders, to C:\Backup?

Suddenly, the skies have darkened. It's beginning to rain and thunder. Something's spooked the horses. This is looking bad ...

To keep things simple, let's assume the C:\, the root folder of your C: drive, contains only one file. Naturally, since you're so cool, the file will be named Cool.txt. Now let's see how the Replicator does its job.

First, the Replicator creates the destination folder, C:\Backup, if it doesn't already exist.

Next, it examines the source folder, to see what files it contains. When the Replicator finds your file C:\Cool.txt, it makes an exact copy in the Destination folder. Now your drive contains two files:

C:\Cool.txt
C:\Backup\Cool.txt

Next, the Replicator searches the source folder, C:\, looking for subfolders. And guess what? It finds one. And its name is C:\Backup.

Like a good little Replicator, the program creates a new destination folder, C:\Backup\Backup.

Next, it searches the folder C:\Backup, looking for files it can copy. Sure enough, a file is found: C:\Backup\Cool.txt. Dutifully, a copy is made. Your drive now contains three files:

C:\Cool.txt
C:\Backup\Cool.txt
C:\Backup\Backup\Cool.txt

Are you beginning to see a pattern? Before long, the hard disk would be literally overflowing, filled with subfolders named Backup and files with names like C:\Backup\Backup\Backup\Backup\Cool.txt.

Clearly, any Replicator that would allow this to happen does not get long well with others. So something had to change. The Replicator had to be taught a lesson. But which lesson?

Like most programmers, my first instinct was to take away a user's option. Naturally, user's shouldn't be allowed to specifying a destination folder that was a subfolder of the source folder. They shouldn't be allowed to lead my perfect little child astray. Besides, that's what popular copying programs, like Windows command-line XCOPY, do. They just tell the user No.

But upon reflection, I had a better idea. And I taught it to my program. The latest Replicator still lets you choose your Source and Destination folders freely. You can even ask the program to copy C:\ to C:\Backup, if you like.

How does it avoid the endless copying described above? It uses a simple trick. If it encounters a source file that also resides within the destination, it skips that source file. The same goes for folders. In other words, it won't copy any file or folder more than once.

There's more to say about the latest Replicator, including an exciting new feature that lets you maintain multiple copies of a folder. But we're almost out of time for today. We'll have to save that discussion for our next get-together!

In the meantime, if you'd like to give the new Replicator a try, visit its home page at:

https://www.karenware.com/powertools/ptreplicator

There you can download the program, and its Visual Basic source code too. As always, both are free.

Or if you prefer the convenience of a CD, or want to support Karen's Power Tools, visit my CD home page at:

https://www.karenware.com/licenseme

There you can order your own copy of Karen's Power Tools CD, complete with the latest Replicator. Your CD will also contain the most recent versions of all my Power Tools, including three bonus Power Tools not available anywhere else. The CD even has back issues of all my newsletters, and a special license that lets you use all the Power Tools at work!

Power Tools Store

A number of people have written, asking how they can support the Power Tools programs, web site and newsletter. Fortunately, there are several answers. Buying a Power Tools CD is the most popular way to show your support. Some kind folks have sent donations. And it's possible to sponsor an issue of the newsletter or a Power Tools web page.

But recently I finished work on yet another way folks can support the Power Tools, and have some fun too. It's called Karen's Power Tools Store, a place where you can find special Power Tools T-shirts, mouse pads, hats, tote bags, mugs, and more. And a portion of the price of each item goes directly to heat the secluded Power Tools workshop, and provide other necessities. :)

If you'd like to check it out, and maybe do some shopping for yourself or a friend, drop by the store at:

https://www.karenware.com/store

I think you'll like the quality of the items offered. And if not, every item has a 30-day 100% satisfaction guarantee. If you are unhappy for any reason, just return the item, no questions asked.

Well that's all for now! I've got to grab a bit of sleep. This evening my "baby" brother arrives from Washington, D.C., and the whole family gathers to celebrate my Dad's 73rd birthday! Four generations, a house full of children aged 1 to 50. It ought to be a party to remember.

If you see my Dad tonight, be sure to wave and say "Happy Birthday." And don't forget to tell Dad how much you admire his new Power Tools hat. :)

And if you see me on the 'net this week, be sure to wave and say Hi!

YouTube button
Downloads Today: 24
More than 6000 downloads monthly
Received $184.68 this month* — Thanks!

License for Work

A license is required to use any or all of these tools for your work. You only need one per lifetime. If you make money with Karen's software, read her license agreement.

License for Work $25

Donations + Other Ways

Power Tools Newsletter

November 1st, 2023:

  • What is Karen's QR Code Talker?
  • What is a QR code?
  • What is a Code Talker?

List of All Issues since '99

24836 Verified Subscribers

Subscribe to receive new issues of the newsletter about Karen and her free Power Tools.

Click here to Subscribe

November Revenue* $184.68
*Licenses + Donations - PayPal Fees
Oct $211 Sep $166 Aug $173 Jul $225 Jun $324 May $200 Apr $700 Mar $273 Feb $405 Jan $56 (2023) Dec $349 Nov $546 Oct $253 Sep $232 Aug $189 Jul $379 Jun $188 May $484 Apr $212 Mar $519 Feb $89 Jan $462 (2022) Dec $1088 Nov $151 Oct $133 USD — Thanks again!