I'm trying to create a backup batch file to automate Acronis True Image and backup maintenance.
The USB drive letter changes depending on which machine I'm backing up and /or how many devices are connected and using drive letters...
My batch resides in C:\
My batch will call ATI.
ATI dumps an image onto C:\
The batch then looks for my external based on its volume serial number like so:
SET SN=30BC-F5A4
SET found=
0>NUL SET /P=Searching for external drive...
TIMEOUT 3 /NOBREAK >NUL
FOR %%N IN (D E F G H I J K L M O P Q R S T U V W X Y Z) DO (
IF defined found CALL :MOVE
VOL %%N: 2>NUL | FIND "%sn%" >NUL && CALL :MOVE %%N
)
ECHO Fail^^!
TIMEOUT 3 /NOBREAK >NUL
ECHO.
ECHO Connect it now and cancel "Autoplay".
TIMEOUT 3 /NOBREAK >NUL
ECHO.
ECHO Press any key to try again...
PAUSE >NUL
CALL: EXTERNAL
:: ***MOVE BACKUP***
:MOVE
OK, that work just fine, but what I'm needing now is something along the lines of;
Find the correct external device based off of serial number. (As above)
Grab the correct drive letter and turn it into a variable.
Break out of the FOR IN DO
loop when the drive letter is found and make it a variable.
Use variable to check if a folder exists.
If the folder doesn't exist, create it.
If the folder does exist, check if MyBackup.tib
exists within.
If so, delete the file.
CHDIR
or somesuch back to where the batch resides, (C:\
) and MOVE
the newly created backup into the folder on the external.
I'm coming up on ten hours straight working on this issue and I'm no closer to finding the correct syntax/command(s) than I was at the start.
PLEASE, can you help!? I'll give you a cookie, lol!
I'm running Windows 7 Ultimate if that helps...