|
Answer» I have this batch: Code: [SELECT]@ECHO Color f0 cd C:\Music\Game\ md BGMBackup md bgmoriginal cd C:\ copy C:\Music\Game\bgm\* C:\Music\Game\BGMBackup copy C:\Music\Game\bgm\* C:\Music\Game\BGMOriginal color f2 echo: Process Finished TIMEOUT 3 I want to add a code that checks for for C:\Music\Game\BGMBackup If it's there i want it to Stop the batch and not to do the backup. And a Display message that says Backup is already created, Cancelling OPERATION...
I am sorry for the trouble... Code: [Select]@echo Color f0 If exist "C:\Music\Game\BGMBackup\" ( echo Backup is already created, Cancelling operation... GOTO :EOF ) cd C:\Music\Game\ md BGMBackup md bgmoriginal cd C:\ copy C:\Music\Game\bgm\* C:\Music\Game\BGMBackup copy C:\Music\Game\bgm\* C:\Music\Game\BGMOriginal color f2 echo: Process Finished TIMEOUT 3This should do the same thing as your code but be a little more robust and also handle long pathnames.
Code: [Select]@echo Color f0 If exist "C:\Music\Game\BGMBackup\" ( echo Backup is already created, Cancelling operation... goto :EOF ) echo Creating backup... please wait md "C:\Music\Game\BGMBackup" 2>nul md "C:\Music\Game\bgmoriginal" 2>nul copy /b "C:\Music\Game\bgm\*" "C:\Music\Game\BGMBackup" >nul copy /b "C:\Music\Game\bgm\*" "C:\Music\Game\BGMOriginal" >nul color f2 echo: Process Finished TIMEOUT 3Thnx i really needed that!!
|