How to Copy a File & All Subfolders in DOS

Written by jason artman
  • Share
  • Tweet
  • Share
  • Email

If you have had to troubleshoot or back up files from a failed computer, you are likely to be familiar with the DOS copy command. The copy command creates a copy of a file, or all files in a folder, moving the copy (or copies) to the destination of your choice. However, using the copy command, you must manually copy the files from any subfolders beneath the first. This process is tedious and easy to do incorrectly. Most versions of DOS eliminate this problem by including the "xcopy" command, which can copy the contents of a folder and all subfolders beneath it. Use the xcopy command to back up a folder and its subfolders in DOS.

Skill level:
Moderately Easy

Things you need

  • MS-DOS 3.3 and later
  • Windows 95 and later

Show MoreHide


  1. 1

    Type "cd C:\" after booting the computer to a DOS prompt or opening a command prompt in Windows. Press "Enter." This command moves you to the root directory of the primary hard drive. If you have already created a folder to transfer files into, skip to Step 3.

  2. 2

    Type "md backup" and press "Enter." This command creates a folder called "backup." This is the folder that the folder structure you are backing up will be copied into.

  3. 3

    Type "xcopy /e (source folder)*. (destination folder)" and press "Enter." The full path to each folder must be used. For example, if the files and subfolders that you wanted to copy were located in "c:\work\files," and you created a folder with the same name and path as described in Steps 1 and 2, type "xcopy /e c:\work\files*. c:\backup" and hit "Enter." This command copies the complete folder structure, along with all files contained within, to the second folder.

Tips and warnings

  • Do not include quotation marks in the commands.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.