Windows, home computer use: command prompt file operations: xcopy

Maintaining a home computer requires frequent self-tutoring. The tutor shares.

This Windows 7 computer no longer performs the COPY command from the mouse, so I use the command prompt to copy files, etc.

Lately I’ve been backing up directories, which contain subdirectories and so on. (Directory can also be thought of as Folder.)

To copy an entire directory, including its subdirectories and the folders contained therein, I use the xcopy command:

xcopy source_directory destination_directory /e


xcopy source_directory destination_directory /s

With /e it copies the empty folders, but not with /s.

In my experience, assigning a destination directory is important, since xcopy doesn’t copy the enclosing directory itself, just its contents. So, for instance, if you want to copy the directory desktop0 to a backup called desktop0, you might key

xcopy the_source_path\desktop0 the_destination_path\desktop0 /e


  1. Although you can use the forward slash to navigate in Windows, it can’t (in my experience) be used in paths in Windows commands. Rather, the backslash must be. For instance, topdir\dir1\dir2 must be used, rather than topdir/dir1/dir2, within a file command such as xcopy. However, for switches such as /s or /e, the forward slash is used.
  2. You can’t use xcopy from within a directory you’re telling it to copy. I typically do it from the one above.


Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.