http://www.tech-pro.net/howto_033.html
"To use the batch file, open a command prompt and type SYNC followed by the paths of the two folders you want to synchronize, each in quotes. If you want to synchronize subfolders as well, add /S to the command line before pressing Enter. For example, suppose your project is kept in a folder called "My Project" on both your local PC and one with a network name of "DELL". To synchronize this folder, including any subfolders, type the command:
SYNC "C:\My Project" "\\DELL\My Project" /SWe recommend that you test this on something unimportant before trying it on valuable work files. Note that the two-line batch file has no "idiot-proofing", so it will happily try to synchronize entire hard disks if you tell it to! This method works, but it gets tiresome having to type in the paths of the two folders."
p.s. I did not test above method. Donald99
no, there is no such thing as a sync command
you ripped that out of it's context
they MADE a sync command that did this:
XCOPY "%1" "%2" /D /I %3
XCOPY "%2" "%1" /D /I %3
this is NOT wath he wants, this would put the same files on the master as on the client, only the client should get the same files of the master. the master should remain unaltered
a simple xcopy should do the trick, but it will only copy new files on the master to the client, and not delete files on the client that are no longer on the master
I had a similar problem on my external hdd but i managed to get around the problem
this batch file is run from my hdd (client)
small part of my solution:
title = making music backup...
xcopy /d /c /y "C:\Users\Polle\Music" "%~d0\Music" this copys all music files from my pc (master) to my hdd (client)
for /r "%~d0\Music\" %%F in (*.*) do echo %%F>> file.txt this lists all music files on my hdd (client) and puts them in a file called file.txt
for /F "tokens=2* delims=\" %%I in (file.txt) do if not exist "C:\Users\Polle\%%I\%%J" del "%~d0\%%I\%%J" takes each entry in file.txt and checks if it exists on my pc (master), if not, it deletes the file from the hdd
del file.txt delete the list of files
for /f "usebackq delims=" %%d in (`"dir /ad/b/s | sort /R"`) do rd "%%d" deletes all empty folders
this should do the trick, but it will need some adjusting if you want to use it
any of the gurus can improve this piece of code? I don't know that much of batch, but I managed to get around this problem this way, is there an easier or better way?