Advertisement

09.11.2008 at 02:25PM PDT, ID: 23724710 | Points: 50
[x]
Attachment Details

syns the directories and files from source to destination

Asked by mh0039593 in Windows Batch Scripting, MS DOS, rSync Backup Utility

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 "\\Vcd061.vc.eaglecrk.local/New Folder"  
xcopy "C:\New Folder" "\\Vcd061.vc.eaglecrk.local/New 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  
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
@echo off   
  
if "%3"=="" (   
echo Syncing "C:\New Folder" with "\\Vcd061.vc.eaglecrk.local/New Folder"   
xcopy "C:\New Folder" "\\Vcd061.vc.eaglecrk.local/New 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
 
Keywords: syns the directories and files from sou…
 
Loading Advertisement...
 
[+][-]09.11.2008 at 02:34PM PDT, ID: 22455219

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.11.2008 at 02:39PM PDT, ID: 22455266

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.11.2008 at 06:26PM PDT, ID: 22456485

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.12.2008 at 12:03AM PDT, ID: 22457653

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.15.2008 at 06:16PM PDT, ID: 22484180

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.15.2008 at 11:34PM PDT, ID: 22485355

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.16.2008 at 03:42PM PDT, ID: 22493993

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628