How do I mirror a directory?

8:54 AM

In order to mirror a directory in Windows, you first have to scope out the right tool for the job. As such, you should ask your self a few questions before starting your search:
  1. How much data do you need to replicate
    • Number of directories and folders
    • Number of files in the directory structure
    • Size per file and size total
  2. What sort of environment is being used to send over the data?
    • Local network copy
    • From one data center to another
  3. Network latency if not within the same network
  4. SLA on how fast the data needs to be sent over
  5. How often does the data need to be replicated over
    • One time migration
    • Mirroring of the directory structure
  6. What protocol can you ship the data over with?
    • CIFS
    • FTP
    • HTTP
  7. Do you need to maintain folder and file attributes
Once you have a better understanding of what your data looks like and what sort of conditions you are facing in shipping the data over, you then have to review what tools are out there to aid in replicating the data sets over. There are a bunch of tools that are available for just such an occasion. The table below details the tools which you can use along with examples for where the tool may work best:
Tool Name
Description
Recommended for
Example
copy.exe, xcopy.exe
Built-in tool in the Windows OS
Local folder and file copies
Copying all folders and files give the path excluding all directory names in the exclude.txt file and auto confirming overwrites.  You can also add a /l to do a directory list with no copying.


xcopy /d /s /e /v /y /EXCLUDE:C:\exclude.txt c:\foldername\*.* d:\foldername2\*.*

NOTE - you can exclude folders if you want by specifying a file with the folders tagged as /foldername/ on a single line
robocopy.exe
Built-in tool in Windows 2008; opsbin tool for Windows 2003 machines
Local or remote folder and file copies; can run multiple sessions with or if Windows 2008 use the multithreaded switch to enable more streams.  No file level chunking is available here.
Copy contents with output going to both the current window and into the log file c:\results.log while excluding the C:\temp directory


robocopy" /s /e /r:5 /w:5 /tee /fft /log:E:\results.log c:\foldername x:\foldername *.* /xd c:\temp

richcopy.exe
3rd party Microsoft tool that rivals robocopy.exe with a gui interface and runs multiple threads
Local or remote folder and file copies; GUI interface that can be used with Windows 2003 in a multithreaded fashion.  There is no file level chunking available here.
fastcopy.exe 32-bit | 64-bit
Freeware tool with a nice gui that rivals robocopy.exe; Is not a multithreaded application
Local or remote folder and file copies; alternative to robocopy.exe but runs as a single thread
Sync a directory and write logging to D:\sync.log:


fastCopy.exe /cmd=diff /bufsize=128 /logfile=D:\sync.log /exclude="Temp\" /log=true /verify /no_confirm_stop /auto_close /estimate "c:\foldername" /to="x:\foldername"

bitsadmin.exe
Add-on tool in the support tools pack for Windows 2003 and 2008 that runs multiple threads and intelligently splits individual files for upload/download
Local or remote file copies; Allows for both CIFS and HTTP based copies but requires in the case of HTTP the source to be enabled with the BITS server extensions
Downloading from an HTTP Server:

bitsadmin /transfer jobname /download /priority foreground http://192.168.1.1/filename.zip c:\foldername\foldername2\filename.zip
Downloading from an CIFS mount:

bitsadmin /transfer jobname /download /priority foreground \\192.168.1.1\sharename\filename.zip c:\foldername\foldername2\filename.zip

You Might Also Like

0 comments

Contact Form

Name

Email *

Message *

Translate

Wikipedia

Search results