1.

Solve : Copy/Sync files from network location?

Answer»

Hi there, well I am not to sure if this is possible; I've had a look around and being only new to writing dos based commands (in a batch file) I am stuck with trying to do the following:

At the moment I have two COMPUTERS networked and I want to in a sense "backup/sync" a specific folder (this being the my pictures folder; I want it to have hard COPIES exactly the same on each computer). I've managed to get it to copy the pictures over (only new files from the source that don't exist on the target computer); I want to be able to delete pictures from the target computer that have been deleted from the source computer.

This is what I have at the moment:
-------------------
echo off

echo Grabing New Files From Mary-PC Pictures

NET USE z: \\Mary-PC\Pictures

XCOPY z: c:\Users\John\Pictures\ /D /S /Q

echo Complete

Pause

Exit
------------------

So yeah I want to now delete files from the target computer (John) that are no LONGER on the source computer (Mary-PC) but I am not sure on how to accomplish that.

Any help would be highly appreciated
you could TRY and run the dir /b command redirect that to a text file and run a loop on the text file to see if the file exists on the target computer.

Code: [Select]DIR /B > %temp%\DIRCHECK

SET FILELOC=%temp%\DIRCHECK

FOR /F "usebackq tokens=1-2" %%A in ("%FILELOC%") do (
SET A=%%A&& SET B=%%B && CALL FILECHECK %%A

:FILECHECK



Discussion

No Comment Found