Wednesday, August 26, 2009

Robocopy trumps RichCopy

Microsoft has released a new replacement for Robocopy. What's Robocopy you ask? Only about the best way to copy a lot of files across a network via the command line in Windows.

Robocopy will copy a directory with any amount of files and subdirectories. It will merge the contents of the directories if duplicates already exist in the destination depending on options you pass it. If a file cannot be read, it will pause and retry a certain number of times, and if you lose your network connection during the copy, when your connection is back, you can reissue the same command, and it will pick up where it left off, not recopying the files it already copied.

It's a really great command line tool and I wish drag and drop copying in both Windows and Mac OS X behaved like this instead of failing miserably if the network drops or wiping destination directories out even if they contain different files from the source.

Robocopy is great. It's one of the first things I install on a freshly formatted Windows box.

So what could be better then Robocopy? According to Microsoft TechNet, RichCopy. RichCopy is the next generation Robocopy adding an easy to use GUI and performance enhancing multithreaded copying (so it can move more then one file at a time which reduces network lag if you are moving a lot of small files.)

So today I installed RichCopy and put it to the test. I needed to move a directory that had 19.8GB in 69,510 files and 13,654 directories (or folders if you prefer.) I started RichCopy and used its GUI interface to start the copy. My network performance was only about 10Mbps (I'm on gigabit people) but it's an overworked corporate network, so I don't think that's any fault of RichCopy. Unfortunately about an hour and 45 minutes into the job, the server disappeared from the network for a second. No problem, right? That's the kind of thing RichCopy was made to handle. Unfortunately at that point RichCopy crashed with an exception, and the only option was to close the exception dialog which closed the RichCopy application.

So now I've got Robocopy doing the copy. It doesn't have a fancy GUI but it's working.

Oh BTW, there is also a GUI for Robocopy here. But I tried it and it had at least one bug (back when I tried it.) It may work for you, but, if you are looking for a robust copy tool, chances are you can handle the command line anyway.

Here's something to get you started on Robocopy:

robocopy source destination /S

By default robocopy won't copy files that appear the same so it always performs a merge and that's what this command line will to. The /S says to be recursive but don't copy empty directories.

The Wikipedia entry on Robocopy covers all the optional parameters.

Tuesday, August 25, 2009

Fixing Printer Sharing in Mac OS X

Ok, so an odd thing happened trying to print the other day. I share a USB printer from my Mac to other computers on the network. After unplugging the USB cable from my Mac at one point to move some stuff on my desk and then plugging it back into the same Mac, printer sharing for this printer no longer worked.

I could print fine from the computer connected directly to the printer via the USB port. I share it with three other computers and none of them could print to the printer, although they could see it on the network.

When I tried to print from a networked printer the document would simply never print. When I opened the printer queue on the computer I was trying to print from it said:

Unable to get printer status (Forbidden)!

Also if I tried to add the printer to a computer that wasn't using it previously, although the computer could see the printer, it could never choose the correct printer driver.

Here’s the fix:
On the computer sharing the printer (the one the printer is connected to) you have to reset the printing system. Just open Print & Fax in System Preferences and right click in the list of printers and chose “Reset printing system…”

It will ask you if you are sure, and you’ll have to supply an administrator password. That will remove all your printers.

Then you can click the + button and add them manually, however, I found it was easier to power cycle my printer and it was automatically added to the list. Make sure to check Share this printer and you may have to turn on Printer Sharing in the Sharing control panel too. The Print & Fax control panel should notify you if Printer Sharing is not enabled.

You may have to remove and re-add the shared printer on any of your networked computers you wish to print from. Two of my computers started printing to the printer with no problems, but one of them had selected the wrong driver (a generic postscript driver.) You could tell it was wrong because the printer icon didn’t match the one on the computer that the printer is connected to.

It could still print ok with the wrong driver but it couldn’t access any of the printer’s settings such as paper type or print quality.

Here’s things I tried that didn’t work:
  1. Turning off and on printer sharing.
  2. Deleting the printer from the computer I wanted to print from and re-adding it.
  3. Repairing permissions on the computer sharing the printer
  4. Printing from another computer that could see the shared printer. It behaved the same from three different computers.