4/14/2010. I recently decided to drop the habit of backing up all data to optical disks and use a 2 terabyte external hard disk instead. Not exactly cheaper, but what you lose in money (just once) you gain tenfolds in speed, comfort and ease of use, and physical space needed for storage. So I got a 2TB hard drive and fitted it in a USB external box.
Backing up all the new stuff there is no big deal, but it surely was to move the contents of the hundreds of “old” CD/DVD’s in there; doing it manually by dragging files onto the drive was going to be the most cumbersome thing, so I thought that if I had a utility that would let me put a disk inside the cd/dvd drive, and did it all by itself, that would be great. Also this utility had to eject the disk when done, so all I had to do was change it with the next disk in the serie, and after reinserting the tray the program would go on copying files.
In other words, all I wanted to do was to take out the just copied CD/DVD and put inside the next one without even touching a file manager but keep doing whatever else it was that I was doing (writing this howto for example, while every few minutes I reach to the disks stockpile and exchange the disk in the drive). Obvously, abiding by Murphy’s law, there was no such thing, or at least a hour worth of search didn’t bring up anything. Either I went full-manual or I made something like it myself: the time I was going to spend on the development would surely have been way less than the time I would have needed to select files, drag them to the drive, then wait for it to finish to change disks.
My choice fell onto AutoHotKey as the scripting tool (I already knew a little of it, plus it had just the functions I needed), so I invested some more than an hour into studying the language and building up from scratch the code to do exactly what I needed.
And in short, here it is (do not copy it yet, you need to read explanation below):
empty = 1
DriveGet, status, StatusCD, E:
if (status = "stopped" OR status = "not ready")
empty = 0
Loop, *.*, 2, 1
Loop, *.*, , 1
if (A_LoopFileName != "filename1.ext"
&& A_LoopFileName != "filename2.ext"
&& A_LoopFileName != "filename3.ext")
docopy = 0
MsgBox, 4, Overwrite file?, Overwrite file %A_LoopFileFullPath%?
docopy = 1
docopy = 1
if docopy = 1
FileCopy, %A_LoopFileLongPath%, M:\%A_LoopFileFullPath%, 1
MsgBox, Could not copy "%A_LoopFileLongPath%" to "M:\%A_LoopFileFullPath%" with ErrorLevel = %ErrorLevel%.
ErrorLevel = 0
Drive, Eject, E:
As I said before, do not put it in action yet, you’re very likely to need to edit it to your needs.
Replace EVERY occurence of “E:” with the correct drive letter of the cd/dvd drive you’re going to use.
Replace EVERY occurence of “M:” with the correct drive letter of the hard drive you want to copy the files to.
The part with the “filenameX.ext” is for my convenience, and probably yours as well: I have some files on most optical disks that do not need to be copied over to the hard disk, mostly being a catalog file, or maybe the exe of the player for the videos, or whatever. So in place of “filenameX.ext” you need to put the name of those files (if any) that you want the program to ignore (if you need more of them, just duplicate the central line as needed, if you need less, or none at all, either edit that part to your needs, or if you’re not good at it, you can probably leave it as it is, since I do not think there are any files in your collection that are actually named “filenameX.ext”). The “SetWorkingDir, C:\” command is just a temporary buffer for when the disk is ejected, you can leave it as long as you have a C: drive!
Save the code in text format with .ahk extension, install AutoHotKey, and double-click on the .ahk file you just created; if I receive enough requests, I’ll upload an exe version of the utility so you can skip installing autohotkey. This is how the script works: when you launch it, unless it detects the presence of a disk inside the CDrom/DVDrom drive, it does nothing; as soon as you put a cd inside, it proceeds to copy all the files that have names different from the ignored ones, to the chosen destination, respecting the folder structure. If there are any files that already exist on the destination drive, it asks you if you want to overwrite them; there’s a little problem here, I have set the filecopy to do an overwrite, but it won’t work, if I try and overwrite it will just return an error. It’s not a big deal for me as I can just press OK and the program will go on by itself without copying the file, but if you really need to do an overwrite (for example a newer version of the same file) first delete the existing file, then press OK and it should work. As soon as the whole optical disk has been processed, the script will eject the tray of your drive, and pause until it detects again a disk inside, so you have all the time you want to switch disks. As soon as you put a new disk and close the tray, the program will continue the file copy process, in a batch fashion. To close it right click in the green “H” icon that appears in the system tray and press Exit.
I tested it on my pc alone, so I won’t be giving support if it doesn’t work for you… no time for that! I just thought it would have been nice to share something like it in case someone else needed to do the same thing.
On a side note, already a handful of disks failed on me, probably we’re talking about 4%; I didn’t reach yet the point where I switched to DVDs; as far as statistics are concerned, first place for unreadable cd’s are Verbatim Datalife (not plus), second (this is a surprise) TDK Reflex, and last, Traxdata tx; still surprisingly, a green die unknown brand of CDr’s, “CDV”, the very first ones I bought in my life, hence the oldest and the ones burned the longest time ago (about 9 years), were all perfectly readable; perfect results, at least until now, and with top reading speeds, are TDK metalAZO with white printable surface, and Verbatim DataLifePlus with silver surface, both of them (guess what) with blue die; special mention goes also to the TDK d-view’s, and the Verbatim Pastel-Disc, no failures there as well.