A warning to those using robocopy, and a solution. If, like, me, you're
backing up from one removable drive to another, you might worry about
the following. If robocopy is set up to copy, say, the e: drive to the
f: drive, what if you plug in what you want to be the destination drive
for the backup first, and it gets assigned drive letter e:, and then you
plug in what you want to be the source drive, which gets assigned drive
letter f:? Windows XP, at least, seems not to remember drive letters;
it usually just assigns the first unused one. If you go ahead and
execute robocopy, you could wipe out your source data.
Note that you can (and I have) set XP up in such a way that drive
letters are *supposed* to be remembered. Supposedly doing "Change Drive
Letter" in Disk Management under Computer Managment under Administrative
Tools is supposed to make the drive letter you select permanent. But I
guess I'm a bit paranoid. And there's at least one person who claims
that XP forgot this setting.
Anyway, if your source and destination drives have different *names*,
then you don't have to rely on the drive letters being correct. My
source drive is called "data"; my backup drive "data backup". The
following script checks to make sure that the destination drive
contains the phrase "data backup". If it doesn't, it returns an error
code; if it does, it goes ahead and does the robocopy.
Code:
--------------------
@echo off
vol z:|find "data backup">nul
if not errorlevel 1 goto dobackup
if errorlevel 1 goto wrongdest
:dobackup
robocopy y:\ z:\ /mir /xd Recycled Recycler "System Volume Information"
/log:"C:\Documents and Settings\username\Desktop\databackup.log" /np /tee
goto finish
:wrongdest
echo Wrong destination drive!
goto finish
:finish
pause
--------------------
--
dagordon
------------------------------------------------------------------------
dagordon's Profile: http://forums.slimdevices.com/member.php?userid=6804
View this thread: http://forums.slimdevices.com/showthread.php?t=26081
_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/discuss