How to use XCOPY command from windows dos prompt to copy files and folders

XCOPY is a dos command used to copy files or directories from one location to another. Most Windows user may never need to use the dos command prompt to migrate files between network drives but those of us that utilize both mac and pcs may find the need. Recently I obtained a new Windows 7 notebook to use at home and have since been in the process of syncing up my files from my apple macbook. While trying to transfer files off of my network drive I noticed that the transferred would fail silently with no files being copied to my notebook.

As it turned out windows didn’t like some of the file formats and so would quit on the copy without specifying an errors to the user… way to go Microsoft… Luckily for me I have experience with the command line and fired up the ms-dos prompt to see what was happening. After running a quick copy of the folder in question I found out immediately that a folder was unrecognizable by windows and was causing the copy to fail. To transfer the files I ended up using the XCOPY command as it allows you to continue the copy even if an error occurs. For others that may experience similar behavior below is a short How To on the XCOPY command.

Basic Command Format

The basic XCOPY requires 2 parameters the file / folder to be copied and the location the file / folder is to be copied to. If you want to copy a folders content and sub folders then be sure to use the * wild card.

XCOPY -SOURCE FILE- -DESTINATION- -OPTIONS-

Available Options

The XCOPY command has many options the ones we are intereseted in are listed below.

  • /C – copy continues even if an error occurs
  • /S – copy sub folders and files
  • /I – default destination to a folder if command is unsure of destination

Example

XCOPY M:usersuser1* C:usersuser1 /c /s /i

Resources

// DOS // Tips & Tricks //

Comments & Questions

Add Your Comment