Hi, Ive got a batch file that is backing up the contents of the D drive. I want to leave out a specific folder on that drive from backing up each time. Is this possible? The script is below.
Many thanks
@echo off
set error=
rem Set backup location
set dest=G:\Ddrivebackuplive
rem Set source to backup
set source=D:
mkdir %dest% 2>NUL
REM Copy full backup if backuplog.txt doesn't exist
if exist "%dest%\backuplog.txt" goto skipfull
echo FULL BACKUP %date% %time% by %username% > "%dest%\backuplog.txt"
xcopy /c/s/e/y "%source%\*.*" "%dest%"
if errorlevel 1 set error=Full Copy (%errorlevel%)
:skipfull
REM Copy changed files
echo COPY CHANGES %date% %time% by %username% >> "%dest%\backuplog.txt"
xcopy /d/c/s/e/y "%source%\*.*" "%dest%"
if errorlevel 1 set error=%error%Changes (%errorlevel%)
if not "%error%"=="" echo There was an error %error%
if not "%error%"=="" echo There was an error %error% >>"%dest%\backuplog.txt"
echo Backup completed. Press Any Key to end.
pause >NUL
START /WAIT "" "%dest%\backuplog.txt"
cls
exit
Start Free Trial