1.

Solve : Help with ROBOCOPY?

Answer»

Hi,

I have a batch FILE that copies FILES from one server to another. The batch file uses the ROBOCOPY.exe to do the work, but I need to TRY cutting down the number of items sent to the log file which is generated, and hoped someone can assist with this?

my batch file has the flag files configured as below:

set xflags=/E /COPYALL /PURGE /ZB /R:0 /W:0 /LOG+:"%logfile%" /TS /FP /NJH /NJS /NP

Then, further down the batch file (where all the work is done) I have the following:


for /f "tokens=1,2* delims=:" %%G IN (%datafile%) DO (
if %%G==REM echo skipping %%H
if NOT %%G==REM (
@ECHO Copying %%G:%%H
@ECHO %date% %time% Copying %%G:%%H >> %logfile%
%roboloc% "%%G:%%H" "c:\%%H" %xflags%
@ECHO %date% %time% %%G:%%H Copied >> %logfile%
)
)


Obviously the entry %roboloc% is configured with a set command to the location of the exe.

Now, the idea is that I copy all files the first time, and then every time the file is run again, it will only copy across the files that are different.

If I say "server A" holds a location "C:\getmyfiles" which contains a number of sub folders, which also contain subfolders, and I WANT these to be duplicated on another server (lets say "server B"), then the batch file runs on "server B" and copies anything it does not have. All files are recorded at the moment in a backup log, regardless of whether they are NEW, old etc.

I want my batch file to only copy the files from "server A" that are not present on "server B", and also remove files from "server B" if they are not present on "server A" (which I believe the /PURGE flag will do for me).
I also only want to record in my log file if the file was copied or deleted, and ignore every other file.

I hope this is enough information and that it is understandable enough.

Offers with help will be kindly accepted.

Regards

RichQuote from: Northenlad60 on February 10, 2011, 08:30:17 AM

Now, the idea is that I copy all files the first time, and then every time the file is run again, it will only copy across the files that are different.

What O/S's are you using? I'm pretty sure XCOPY has this as a built in feature.

There are also other syncronisation tools out there that seem to do what you want, that might be simpler to setup.

Like : http://www.codeproject.com/KB/files/FileSync.aspx


Discussion

No Comment Found