Sync and deleting using batch file

I have this batch file. It syns the directories and files from source to destination. I'm trying to modify it so that if a file exist in destination that does not exists in source that file should be deleted off the destination machine in addition to the sync of source and destination which the below command will do. Any help would be greatly appreciated.

@echo off  
if "%3"=="" (  
echo Syncing "C:\New Folder" with "\\ Folder"  
xcopy "C:\New Folder" "\\ Folder" /d /i /y /e
for /D %%d in (%2\\*) do (  
if not exist "%1\\%%~nd" (  
echo Deleting directory %%~nd  
rd "%%d" /s /q  
for %%f in (%2\\*) do (  
if not exist "%1\\%%~nf%%~xf" (  
echo Deleting file %%~nf%%~xf  
del "%%f"  
for /D %%d in (%1\\*) do call Batch3.bat "%1\\%%~nd" "%2\\%%~nd" 0  

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

dlangrConnect With a Mentor Commented:
i would use robocopy:
ROBOCOPY source dest /MIR
oh, 1 word of warning, be carefull, it WILL delete all files missing in source from dest and it will do it very quickly
Second the motion on robocopy.  It seems to me you're reinventing the wheel doing it through batch script.
All Courses

From novice to tech pro — start learning today.