Robocopy batch script help

I have a batch script that uses robocopy to copy data from one file server (2003) to a new files server (2008R2 or 2012)

I have been running the tool on the destination server, thats why dst= local drive path.

The thing is its not copying all the data... I would also like to mirror exactly what is on the old server to the new server.
And security settings dont appear to be correct.  I do not want to purge, move, or delete the data off the old server.
I want to setup a task or perhaps use the mon or mopt switches to run at specific times every night, until we are ready to turn the switch over.

Fianlly the log out put is a bit hairy... I just want to know what copied and if it was sucessful or failed, for both files, and directories
Of course I want all folders, and subfolders and all files within the given path.

/MIR /SEC / COPYALL?

I dont really know how the /XO /xd operates, but maybe its excluding files somehoW That should be mirrored.
I also want to  copy all hidden files, read-only, system, achieved, and etc. except for the list of items below.

[Files:]

Thumbs.db ~*.*
*.swp
*.dmp
*.tmp
pagefile.sys
hiberfil.sys

[Folders:]

MCAF*.TMP
"$VAULT$.AVG"
"_RESTORE"
"MSOCache"
"Recycled"
"RECYCLER"
"Temporary Internet Files"
"System Volume Information"
"temp"


This is the simple robocopy that was made, but its not using the /MIR command, and when I try to add it, it just sits there and does nothing.
Also the output lists all the files and etc. I just want a summary as forementioned.

Any help to make this perfecto.




@echo off
cls

set src=\\oldserver\f$\share
set dst=E:\share
set swt=/E /ZB /COPY:DATSOU /DCOPY:T /MT:128 /XO /R:10 /W:30 /V /TS /FP /ETA /TEE
set log=C:\temp\%~n0_%date:~10,4%.%date:~4,2%.%date:~7,2%.txt
robocopy %src% %dst% %swt% /LOG:%log%
@echo off
cls

Open in new window


More over, I have been updating the file for each old server to new server, is there a way to make one inclusive file that has
multiple sources and multiple desitnations

example src1 = oldserver1\share
        dst1 = newserver1\share

      src2 = oldserver2\Users
      dst2 = newserver\users

So src1 copies the share from old to new and src2 copies user shares.


I would also like to have a bit of checking and notification in the script.

Example

echo Testing to see if src host is online.
  ping oldserver | find "TTL" > nul
  if not errorlevel 1 (
    Echo oldserver is online.
      or if the server is offline - report it is down.
    Pause
    echo Preparing to copy src1 to dst1  and if doing more src2 and dst2 it would list that as well.
And can you make the preparing to copy in Bright RED.. so they can make sure path is correct?
LVL 5
IndyrbAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITCommented:
> ... security settings don't appear to be correct.
Add /SECFIX and /TIMFIX
0
NVITCommented:
> ... I just want a summary
Add...

/NS :: No Size - don't log file sizes.
/NC :: No Class - don't log file classes.
/NFL :: No File List - don't log file names.
/NDL :: No Directory List - don't log directory names.
/NP :: No Progress
0
NVITCommented:
Try minimizing it...
If that works, add the switches bit by bit.

Note: You may want to adjust the source path for now as it may take awhile to finish the copy, depending on how much files you have.

set src=\\oldserver\f$\share
set dst=E:\share
set log=C:\temp\%~n0_%date:~10,4%.%date:~4,2%.%date:~7,2%.txt
robocopy %src% %dst% /mir /log:%log%
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

IndyrbAuthor Commented:
in the log that is the ~ telda and 4% 2% and etc mean?

Also can you list what the code would look like with the /MIR and the /SECFIX /TIMFIX
and all the

/NS :: No Size - don't log file sizes.
 /NC :: No Class - don't log file classes.
 /NFL :: No File List - don't log file names.
 /NDL :: No Directory List - don't log directory names.
 /NP :: No Progress

Like with my current code...
0
NVITCommented:
As I mentioned earlier...
- You may want to adjust the source path for now as it may take awhile to finish the copy, depending on how much files you have. This will get you results quicker.
- After each run, examine the backup to see if you are satisfied. e.g.
set src=\\oldserver\f$\share\folder1\testfolder

Open in new window


> in the log that is the ~ telda and 4% 2% and etc mean?
Basically, it is extracting parts of the date and time strings for use as the filename. For now, use a simple log filename as I've shown below.

> Also can you list what the code would look like with the /MIR and the /SECFIX /TIMFIX

set src=\\oldserver\f$\share
set dst=E:\share
set swt=/MIR /SECFIX /TIMFIX /COPYALL /DCOPY:T /XO /R:0 /W:0 /NS /NC /NC /NFL /NDL /NP
set log=%temp%\robocopy_log.txt
robocopy %src% %dst% %swt% /log:"%log%"

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
IndyrbAuthor Commented:
would these switches work... used yours with the added /ZB /MT:128 /ETA /TEE

swt=/MIR /ZB /SECFIX /TIMFIX /COPYALL /DCOPY:T /MT:128 /XO /R:100 /W:30 /NS /NC /NC /NFL /NDL /NP
/ETA /TEE

Does the /XO  exclude files that are the same? from source to destination?
0
IndyrbAuthor Commented:
or this with the /V

set swt=/MIR /ZB /SECFIX /TIMFIX /COPYALL /DCOPY:T /MT:128 /XO /R:100 /W:30 /NS /NC /NC /NFL /NDL /NP /V
/ETA /TEE
0
NVITCommented:
Have you tested the one I posted? If it works, add your other switches. Then test.
0
IndyrbAuthor Commented:
I don't want /purge and somehow it said options /purge and I didn't add this
0
IndyrbAuthor Commented:
is the /mir adding purge... I ran it.... Did it remove anything from source?
0
NVITCommented:
/mir erases from destination, not the source.
0
NVITCommented:
See http://ss64.com/nt/robocopy.html for a good explanation
0
IndyrbAuthor Commented:
oooh so if the file from source was removed.... /mir says hey that file doesn't exist, so it needs to remove from destination??

Its a total mirror.... right?
0
NVITCommented:
> Its a total mirror.... right?
Correct.
0
IndyrbAuthor Commented:
thank you
0
NVITCommented:
You're welcome, Indyrb. I'm glad to help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.