Thanks,
Andy
:: Backup files from c: drive to thumbdrive j:
@echo off
if exist
c:
cd/
cd Backup
xcopy /d /y c:\Backup\lmtd_bks.zip j:\Backup
xcopy /d /y c:\Backup\wrdbckup.zip j:\Backup
xcopy /d /y c:\Job_Search\All_Resumes.zip i:\Job_Search
cd "C:\Documents and Settings\Administrator\Application Data\Mozilla
\Firefox\Profiles\gkpd58dg.default"
xcopy /d /y bookmarks.html j:\Backup
Hi,
Well, i do it like this. First i create a file on a stick like stick.dummy
Here�s the trick to "find" the driveletter of your stick
FOR %%I in (D E F G H I J K L M N O P Q R S T U V W X Y Z)DO IF exist
%%I:\stick.dummy SET LW=%%I
your batchfile would look like this then
:: Backup files from c: drive to thumbdrive j:
@echo off
FOR %%I in (D E F G H I J K L M N O P Q R S T U V W X Y Z)DO IF exist
%%I:\stick.dummy SET LW=%%I
c:
cd \Backup
xcopy /d /y c:\Backup\lmtd_bks.zip %LW%:\Backup
xcopy /d /y c:\Backup\wrdbckup.zip %LW%:\Backup
xcopy /d /y c:\Job_Search\All_Resumes.zip i:\Job_Search
cd "C:\Documents and Settings\Administrator\Application
Data\Mozilla\Firefox\Profiles\gkpd58dg.default"
xcopy /d /y bookmarks.html %LW%:\Backup
the only problem could be that your usbstick could be invisible if it
gets the same letter as a previously created networkdrive. Then you
would have to clear the assignment of that networkletter first (NET USE
(Networkletter:) /D
Andrew
When I tried you bat file, xcopy said it could not find the path.
I opened a cmd window and xcopy works in copying files from C: drive
to the thumbdrive.
Maybe there is a way to set an environmental variable that the bat
file could check for?
Or try to create a file on the thumbdrive and branch accordingly.
Andy
> I am trying to modify this to check first that J: drive exists. (I am
> using TrueCrypt for a partition on a thumbdrive and the volume may not
> have been mounted when this is run.)
You posted from XP - if that is the OS of interest, then
if not exist j:\ goto :no_drive
with, of course, a lable :no_drive at the ehad of the code to execute if
the drive is not present, or at the end of the code to skip.
Note that the test fails if the drive is physically present, but has no
file system (an empty CD drive, for example) - it is not a test for the
drive; it is a test for a readable file system on the drive.
--
T.E.D. (tda...@mst.edu)
Thanks, I will try it.
Andy
> On Jun 15, 8:29 am, Andrew <vnc_serv...@t-online.de> wrote:
>> WhiteTea77581 schrieb:
>> > I am trying to modify this to check first that J: drive exists.
>> > (I am using TrueCrypt for a partition on a thumbdrive and the volume
>> > may not have been mounted when this is run.)
> When I tried you bat file, xcopy said it could not find the path.
Those 2 Lines have to be one ! (without the >>
of course). Other than that i didn�t alter your batch.
>> FOR %%I in (D E F G H I J K L M N O P Q R S T U V W X Y Z)DO IF exist
>> %%I:\stick.dummy SET LW=%%I
After reading your post again i�m not sure if you want to copy your
files onto your stick or on to that TrucryptVolume on that stick
If you want to copy it onto that TC Volume i see no way of looking for a
unmounted volume on a stick
regarding ...
If exist Drive:\ goto :whatever
i think this one is more bulletproof
If exist drive:\NUL goto :whatever
Andrew
@echo off
if NOT EXIST j:\nul goto end
xcopy /d /y c:\Backup\lmtd_bks.zip j:\Backup
xcopy /d ........etc,
.............and end with this:
:end
...your 'cd' command is unnecessary at the beginning as you give the
whole paths in the first few 'xcopy' commands.
However, your next 'cd' command IS needed, as you change directory
*before* using the 'xcopy' command to copy a file [bookmarks.html] to
j:\backup
Be sure to include the line-label :end at the very end of your
script, then the line if NOT EXIST j:\nul goto end
will send the focus to this line and, being at the end, will exit if
it does not find dive j:
==
Cheers, Tim Meddick, Peckham, London. :-)
"WhiteTea77581" <andrewk...@peoplepc.com> wrote in message
news:6efd2f4a-b4c7-4b72...@x29g2000prf.googlegroups.com...
>Thanks,
> Andy
I would use lables & use them pretty much like this:
if exist j: goto :found
goto :notfound
goto :end
:found
xcopy /d /y bookmarks.html j:\Backup
:notfound
:end
Sorry if the wordwrap is messed up, this is a fresh install...