Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7807493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:52:10+00:00 2026-06-02T02:52:10+00:00

I’m looking to do some massive copy’s during a server migration and I need

  • 0

I’m looking to do some massive copy’s during a server migration and I need to better understand the copy commands in Windows Server. I’ve been toying with xcopy, but I really am having a difficult time understanding it fully. Is there some good literature out there or can anyone help me with this? Is there any other software or commands I could use?

I’m looking to do this to a full array of 37 servers, so I’m looking for guidance on creating a script I can input multiple directories into so that I can leave this running for as long as it takes.

So far this is what I’ve been doing:

xcopy C:\Directory\*.* \\Server\Directory\*.* /S /V

It’s working, but when I get an error it stops… and I’m not really sure the direction I should go for starting up a batch file for this project. Should I use variables? Should I prompt for the directories? What’s the “best” way?

Any help would be appreciated, thanks in advanced!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:52:11+00:00Added an answer on June 2, 2026 at 2:52 am

    Now on to actually solving what you’re asking.

    I have run into a similar problem at my work as well. I’ve actually developed some code that can take 3 copies at a time (either roboCopy or xCopy) and will create the script for later use.

    Try this out and let me know if it works!

    @ECHO OFF
    COLOR 0A
    TITLE product_X Migration Copy Tool
    
    echo.This script should always be run FROM the Source Machine
    echo.
    choice /C:RX /N /M "(R)RoboCopy or (X)Xcopy:" 
    IF '%ERRORLEVEL%'=='1' set copyMode=Robo
    IF '%ERRORLEVEL%'=='2' set copyMode=X
    
    cls
    echo.Are you using UNC paths?
    choice /C:YN /N /M "(Y)Yes or (N)No"
    IF '%ERRORLEVEL%'=='1' set UNC=UNC
    IF '%UNC%'=='UNC' GOTO regEdit
    IF '%ERRORLEVEL%'=='2'  set UNC=drive
    IF '%UNC%'=='drive' GOTO SourceDrive1
    
    :SourceDrive1
    cls
    IF /I '%source1Error%'=='T' echo.Location does not exist, try again...
    IF /I '%source1Error%'=='T' echo.
    set source1Error=F
    echo._.-*Set your FIRST copy source/destination*-._
    echo.
    set SourceDrive1=
    set /p SourceDrive1=What is the Local folder you want to copy from?: 
    IF NOT DEFINED SourceDrive1 set source1Error=T
    IF /I '%source1Error%'=='T' GOTO SourceDrive1
    echo.
    
    :destDrive1
    echo.
    echo.What is the %UNC% location you want to copy %sourceDrive1% to?
    set dest1Error=F
    set destDrive1=
    IF '%UNC%'=='UNC' echo.(Make sure you include the '\\' before your location)
    set /p destDrive1=: 
    IF NOT DEFINED destDrive1 set dest1Error=T
    IF /I '%dest1Error%'=='T' echo.Location does not exist, try again...
    IF /I '%dest1Error%'=='T' GOTO destDrive1
    cls
    verify >nul
    echo.You will perform a %copyMode%Copy on %SourceDrive1%\*.* to %destDrive1%\*.*
    echo.
    echo.Is this correct?
    echo.(If you choose (Z)Done you will move on to start %copyMode%Copying)
    echo.
    choice /C:YNXZ /N /M "(Y)Yes, (N)No, (X)Back or (Z)Done:" 
    IF '%ERRORLEVEL%'=='1' GOTO SourceDrive2
    IF '%ERRORLEVEL%'=='2' GOTO destDrive1
    IF '%ERRORLEVEL%'=='3' GOTO SourceDrive1
    IF '%ERRORLEVEL%'=='4' set allDone=1
    IF '%ERRORLEVEL%'=='4' GOTO finalWarning
    
    :SourceDrive2
    cls
    IF /I '%source2Error%'=='T' echo.Location does not exist, try again...
    IF /I '%source2Error%'=='T' echo.
    set source2Error=F
    echo._.-*Set your SECOND copy source/destination*-._
    echo.
    set SourceDrive2=
    set /p SourceDrive2=What is the next Local folder you want to copy from?: 
    IF NOT DEFINED SourceDrive2 set source2Error=T
    IF /I '%source2Error%'=='T' GOTO SourceDrive2
    echo.
    
    :destDrive2
    echo.
    echo.What is the %UNC% location you want to copy %SourceDrive2% to?
    set dest2Error=F
    set destDrive2=
    IF '%UNC%'=='UNC' echo.(Make sure you include the '\\' before your location)
    set /p destDrive2=: 
    IF NOT DEFINED destDrive2 set dest2Error=T
    IF /I '%dest2Error%'=='T' echo.Location does not exist, try again...
    IF /I '%dest2Error%'=='T GOTO destDrive2
    cls
    verify >nul
    echo.You will perform a %copyMode%Copy on %SourceDrive2%\*.* to %destDrive2%\*.*
    echo.
    echo.Is this correct?
    echo.(If you choose (Z)Done you will move on to start %copyMode%Copying)
    echo.
    choice /C:YNXZ /N /M "(Y)Yes, (N)No, (X)Back or (Z)Done:" 
    IF '%ERRORLEVEL%'=='1' GOTO SourceDrive3
    IF '%ERRORLEVEL%'=='2' GOTO destDrive2
    IF '%ERRORLEVEL%'=='3' GOTO SourceDrive1
    IF '%ERRORLEVEL%'=='4' set allDone=2
    IF '%ERRORLEVEL%'=='4' GOTO finalWarning
    
    :SourceDrive3
    cls
    IF /I '%source3Error%'=='T' echo.Location does not exist, try again...
    IF /I '%source3Error%'=='T' echo.
    set source3Error=F
    echo._.-*Set your SECOND copy source/destination*-._
    echo.
    set SourceDrive3=
    set /p SourceDrive3=What is the last Local folder you want to copy from?: 
    IF NOT DEFINED SourceDrive3 set source3Error=T
    IF /I '%source3Error%'=='T' GOTO SourceDrive3
    echo.
    
    :destDrive3
    echo.
    echo.What is the %UNC% location you want to copy %SourceDrive3% to?
    set dest3Error=F
    set destDrive3=
    IF '%UNC%'=='UNC' echo.(Make sure you include the '\\' before your location)
    set /p destDrive3=: 
    IF NOT DEFINED destDrive3 set dest3Error=T
    IF /I '%dest3Error%'=='T' echo.Location does not exist, try again...
    IF /I '%dest3Error%'=='T' GOTO destDrive3
    cls
    verify >nul
    echo.You will perform a %copyMode%Copy on %SourceDrive3%\*.* to %destDrive3%\*.*
    echo.
    echo.Is this correct?
    choice /C:YNX /N /M "(Y)Yes, (N)No or (X)Back"
    IF '%ERRORLEVEL%'=='1' GOTO finalWarning
    IF '%ERRORLEVEL%'=='2' GOTO destDrive3
    IF '%ERRORLEVEL%'=='3' GOTO SourceDrive2
    
    :finalWarning
    cls
    echo.
    echo.             * * * WARNING * * *
    echo.This will execute with the following variables
    echo.
    echo.%copyMode%Copy:
    echo.%SourceDrive1%\*.* to %destDrive1%\*.*
    echo.
    IF '%allDone%'=='1' GOTO questionWarning
    echo.%SourceDrive2%\*.* to %destDrive2%\*.*
    echo.
    IF '%allDone%'=='2' GOTO questionWarning
    echo.%SourceDrive3%\*.* to %destDrive3%\*.*
    echo.
    
    :questionWarning
    echo.Do you want to SAVE your config to use later?
    echo.
    echo.Select Yes to start, No to go to the beginning or Back to go back one step
    choice /C:YNX /N /M "(Y)Yes, (N)No or (X)Back"
    IF '%ERRORLEVEL%'=='1' set copyConfig=Y
    IF '%ERRORLEVEL%'=='2' set copyConfig=N
    IF '%ERRORLEVEL%'=='3' GOTO SourceDrive3
    cls
    IF /I '%copyConfig%'=='Y' goto saveConfig
    IF /I '%copyConfig%'=='N' goto SourceDrive1
    
    :preStart
    FOR /F %%A IN ('TIME/T') DO SET time=%%A
    FOR /F "tokens=1-4 delims=/ " %%B IN ('DATE /t') DO SET date=%%C/%%D/%%E
    echo.
    echo.Do you want to start %copyMode%Copying?
    echo.Select Yes to start, No to go to the beginning or Back to go back one step
    choice /C:YNX /N /M "(Y)Yes, (N)No or (X)Back"
    IF '%ERRORLEVEL%'=='1' GOTO start
    IF '%ERRORLEVEL%'=='2' GOTO SourceDrive1
    IF '%ERRORLEVEL%'=='3' GOTO questionWarning
    
    :start
    IF NOT EXIST C:\TEMP\product_X\TEMP MD C:\TEMP\product_X\TEMP
    echo.%date% -%time% - %copyMode%Copy Started>>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt
    cls
    echo.Running...
    IF /I '%copyConfig%'=='Y' explorer.exe C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\
    IF /I '%copyMode%'=='robo' goto roboCopy
    IF /I '%copyMode%'=='X' goto xCopy
    
    :xCopy
    REM xcopy Source Destination /TRIGGERS
    IF NOT EXIST %destDrive1% MD %destDrive1%
    echo.%date% -%time% - %SourceDrive1%\*.* - to - %destDrive1%\*.*>>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt
    xcopy %SourceDrive1%\*.* %destDrive1%\*.* /d /e /c /r /y
    
    IF '%allDone%'=='1' GOTO end
    IF NOT EXIST %destDrive2% MD %destDrive2%
    echo.%date% -%time% - %SourceDrive2%\*.* - to - %destDrive2%\*.*>>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt
    xcopy %SourceDrive2%\*.* %destDrive2%\*.*  /d /e /c /r /y
    
    IF '%allDone%'=='2' GOTO end
    IF NOT EXIST %destDrive3% MD %destDrive3%
    echo.%date% -%time% - %SourceDrive3%\*.* - to - %destDrive3%\*.*>>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt
    xcopy %SourceDrive3%\*.* %destDrive3%\*.*  /d /e /c /r /y
    
    :roboCopy
    IF NOT EXIST %destDrive1% MD %destDrive1%
    IF NOT EXIST %destDrive1%\RoboCopy_Logfile MD %destDrive1%\RoboCopy_Logfile
    echo.%date% -%time% - %SourceDrive1%\*.* - to - %destDrive1%\*.*>>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt
    robocopy %SourceDrive1%\*.* %destDrive1%\*.* /R:5 /W:3 /Z /XX /TEE /LOG+:%destDrive1%\RoboCopy_Logfile\%destDrive1%_Log.txt
    
    IF '%allDone%'=='1' GOTO end
    IF NOT EXIST %destDrive2% MD %destDrive2%
    IF NOT EXIST %destDrive2%\RoboCopy_Logfile MD %destDrive2%\RoboCopy_Logfile
    echo.%date% -%time% - %SourceDrive2%\*.* - to - %destDrive2%\*.*>>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt
    robocopy %SourceDrive2%\*.* %destDrive2%\*.* /R:5 /W:3 /Z /XX /TEE /LOG+:%destDrive2%\RoboCopy_Logfile\%destDrive2%_Log.txt
    
    IF '%allDone%'=='2' GOTO end
    IF NOT EXIST %destDrive3% MD %destDrive3%
    IF NOT EXIST %destDrive3%\RoboCopy_Logfile MD %destDrive3%\RoboCopy_Logfile
    echo.%date% -%time% - %SourceDrive3%\*.* - to - %destDrive3%\*.*>>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt
    robocopy %SourceDrive3%\*.* %destDrive3%\*.* /R:5 /W:3 /Z /XX /TEE /LOG+:%destDrive3%\RoboCopy_Logfile\%destDrive3%_Log.txt
    GOTO end
    
    :regEdit
    IF NOT EXIST C:\TEMP\product_X MD C:\TEMP\product_X
    echo.Windows Registry Editor Version 5.00> C:\TEMP\product_X\DisableUNCCheck.reg
    echo.;>> C:\TEMP\product_X\DisableUNCCheck.reg
    echo.[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]>> C:\TEMP\product_X\DisableUNCCheck.reg
    echo."DisableUNCCheck"=dword:00000001>> C:\TEMP\product_X\DisableUNCCheck.reg
    regedit /s C:\TEMP\product_X\DisableUNCCheck.reg
    GOTO SourceDrive1
    
    :end
    echo.%copyMode%Copy Completed
    echo.%date% -%time% - %copyMode%Copy Ended>>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt
    echo.---------------------------------------------------------------->>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt
    echo.>>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt
    pause
    exit
    
    :saveConfig
    FOR /F "tokens=1-2 delims=: " %%B IN ('TIME /t') DO SET time=%%B%%C
    FOR /F "tokens=1-4 delims=/ " %%B IN ('DATE /t') DO SET date=%%C%%D%%E
    IF /I '%copyMode%'=='robo' goto roboCopySave
    IF /I '%copyMode%'=='X' goto xCopySave
    
    :xCopySave
    IF NOT EXIST C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves MD C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves
    
    echo.IF NOT EXIST %destDrive1% MD %destDrive1%>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.Saving file: C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    
    echo.echo.%%date%% - %%time%% - %SourceDrive1%\*.* - to - %destDrive1%\*.*^>^>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.xcopy %SourceDrive1%\*.* %destDrive1%\*.* /d /e /c /r /y>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.echo.>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    
    IF '%allDone%'=='1' GOTO preStart
    echo.echo.IF NOT EXIST %destDrive2% MD %destDrive2%>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.echo.%%date%% - %%time%% - %SourceDrive2%\*.* - to - %destDrive2%\*.*^>^>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.xcopy %SourceDrive2%\*.* %destDrive2%\*.* /d /e /c /r /y>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.echo.>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    
    IF '%allDone%'=='2' GOTO preStart
    echo.echo.IF NOT EXIST %destDrive3% MD %destDrive3%>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.echo.%%date%% - %%time%% - %SourceDrive3%\*.* - to - %destDrive3%\*.*^>^>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.xcopy %SourceDrive3%\*.* %destDrive3%\*.* /d /e /c /r /y>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    GOTO preStart
    
    :roboCopySave
    IF NOT EXIST C:\TEMP\product_X\%copyMode%Copy_Saves MD C:\TEMP\product_X\%copyMode%Copy_Saves
    
    echo.IF NOT EXIST %destDrive1% MD %destDrive1%>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.Saving file: C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    
    echo.IF NOT EXIST %destDrive1%\RoboCopy_Logfile MD %destDrive1%\RoboCopy_Logfile>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.echo.%%date%% - %%time%% - %SourceDrive1%\*.* - to - %destDrive1%\*.*^>^>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.robocopy %SourceDrive1%\*.* %destDrive1%\*.* /R:5 /W:3 /Z /XX /TEE /LOG+:%destDrive1%\RoboCopy_Logfile\%destDrive1%_Log.txt>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    
    IF '%allDone%'=='1' GOTO preStart
    echo.IF NOT EXIST %destDrive2% MD %destDrive2%>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.IF NOT EXIST %destDrive2%\RoboCopy_Logfile MD %destDrive2%\RoboCopy_Logfile>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.echo.%%date%% - %%time%% - %SourceDrive2%\*.* - to - %destDrive2%\*.*^>^>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.robocopy %SourceDrive2%\*.* %destDrive2%\*.* /R:5 /W:3 /Z /XX /TEE /LOG+:%destDrive2%\RoboCopy_Logfile\%destDrive2%_Log.txt>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    
    IF '%allDone%'=='2' GOTO preStart
    echo.IF NOT EXIST %destDrive3% MD %destDrive3%>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.IF NOT EXIST %destDrive3%\RoboCopy_Logfile MD %destDrive3%\RoboCopy_Logfile>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.echo.%%date%% - %%time%% - %SourceDrive3%\*.* - to - %destDrive3%\*.*^>^>C:\TEMP\product_X\TEMP\product_X_Migration_%copyMode%Copy.txt>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    echo.robocopy %SourceDrive3%\*.* %destDrive3%\*.* /R:5 /W:3 /Z /XX /TEE /LOG+:%destDrive3%\RoboCopy_Logfile\%destDrive3%_Log.txt>>C:\TEMP\product_X\Data_Migration\%copyMode%Copy_Saves\%date%_%time%_%copyMode%Copy.bat
    GOTO preStart
    
    
    REM product_X Install Batch Script
    REM Created by Trevor Giannetti
    REM An unpublished work
    REM (March 2012)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.