Xcopy /d check

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
captedgar
Posts: 7
Joined: 22 Oct 2009 18:13

Xcopy /d check

#1 Post by captedgar » 17 Dec 2009 08:09

Hi there

Please suggest anything other than robocop or xxcopy if possible through DOS only.

I have 2 servers A and B.
I have a batch file which will sync B with A.
There are 3 identical folders on A and B and they both are of huge
size.
At the minute everytime we sync server B with A, we are copying the
entire folder across from B to A. This is very time consuming and i'm
trying to reduce this

The copy command i have at the minute is as follows i.e.


xCopy /S \\%2\g$\Utility\Mgt \\%1\g$\Utility\Mgt >>"file.log"


I was thinking of modifying the xcopy command as follows( would it
work)


xCopy /S /d \\%2\g$\Utility\Mgt \\%1\g$\Utility\Mgt >>"file.log"


Please note i have added /d as an extra switch and provided any date
and time values. Coz i can;t check this script at the minute, will my
above modified script compare Mgt folders on both the servers and only
copies those files which are mismatches. Is it also better to use a
beyond compare tool or something like that to achieve my objective?.

please advice

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

#2 Post by avery_larry » 18 Dec 2009 15:34

It's the right idea. The /d switch will behave similar to robocopy. You're best to setup a little test on your workstation to make sure it's working. I can't remember off the top of my head -- it seems like there's some funky way to use the /d switch without a date. Perhaps it must be the last thing on the line or something.

DosItHelp
Expert
Posts: 239
Joined: 18 Feb 2006 19:54

#3 Post by DosItHelp » 18 Dec 2009 22:22

One day I got tired of having to lookup the xcopy flags again for a common backup job I had needed and looked up many times before. So I looked one last time:

/D (without date) copies only new and newer files.
/S Copies directories and subdirectories except empty ones.
/C Continues copying even if errors occur.
/I If destination does not exist and copying more than one file,
/Y Suppresses prompting to confirm you want to overwrite an

and rearranged them to something I could remember:
xcopy /discy [source] [target]


"disc" and a "y" was easy to remember.
It works fine without a slash in front of each option, simply "/discy".

Hope this helps :wink:

Post Reply