Using XCOPY to Synchronize Folders

While there are many more advanced tools for synchronizing folders, one very useful method (on Windows OS) is to use the XCOPY command. The XCOPY command has been part of the windows suite since the DOS days, and provides a helpful set of options that the standard COPY command does not.

If you are in an environment where you have several mobile devices generating content that you would like stored on a central server for backup and group collaboration, the XCOPY command can be a simple solution for performing regular migrations of the new / updated content on your mobile device.

The XCOPY command for copying the updates from one folder to another is as follows:


The flags used in the above example define:

  • /E
    This flag causes all folders and sub-folders to be copied
  • /D
    This flag causes a DATE comparison to be made, only copying items that are newer than the DESTINATION item. If the DESTINATION is older, or does not contain the file, then it will be copied.
  • /C
    This flag tells XCOPY to continue if it encounters an error - typically errors occur with read-only files, or files that have protected permissions
  • /Y
    This flag tells XCOPY to suppress prompting you for confirmation, which is necessary if you intend to create an automation script or scheduled task

If you wish to automate this process, the easiest method is to create a BATCH file and then create either a SCHEDULED TASK, WINDOWS USER LOGIN SCRIPT or a SHORTCUT to the batch file that you would manually run when you connect your device.

To create a BATCH file, you will:

  1. Open Notepad
    Start -> Accessories -> Notepad
  2. Type or Copy the following into the blank document
    @echo OFF
    echo :
    echo : XCOPY Batch Process Started
    echo :
    echo :
    echo : XCOPY Batch Process Complete
    echo :
  3. Save the file as XCOPY_AUTO.BAT somewhere where you can find it. If you don't know where to put it, just save it on your desktop.

Scheduled Tasks and Login Scripts are a bit harder and if you've gotten this far, you should be able to perform a google and find instructions for further automation.

Good Luck and Happy Coding!


  • 30 Users Found This Useful
Was this answer helpful?

Related Articles

Transition from TextPad to Notepad++

This cheatsheet is for Textpad users that for whatever reason may find themselves, after years of...

Windows Hot-Keys for Quick Control

Most computer users have had limited experience with Hot-Keys. The concept of the hot-key is...

Making Files Map for Installation Files

We forget after not using the command prompt for so long, just how helpful it can be.  Of...

ShowMan Disk Space Usage Graph Visualizer

Disk Space Analyzer and Disk Usage Graph Years ago when I received my first computer, I started...

Charging Apple iPhone Without Apple iTunes Installed

The Apple iPhone is pretty cool, but with it comes this pain in the neck software called Apple...

Disqus this...

comments powered by Disqus