1. Home
  2. Windows Tips
  3. Copy folder structure on windows 10

How to copy a folder structure on Windows 10

When you copy and paste folders, all the files, and sub-folders are copied with it. The files all remain in their respective sub-folders, as they should. If you don’t need to copy files but just need to replicate a folder structure without manually creating the folders, you should use Xcopy.

Xcopy is a utility that’s available by default on Windows 10 so you can use this method out of the box to copy and paste a folder structure. You can replicate the structure in any location e.g., if the folder is on your desktop, you can copy it and its entire sub-directory to an external drive, or to a different folder on a different internal drive.

Copy a folder structure

First, move the folder that you want to replicate the structure of, to a new folder that has nothing else in it.

Open a Command Prompt window. You don’t need admin rights to copy a folder structure unless you plan on creating/copying the structure to the C drive which is normally the Windows drive.

Use the following command to copy the folder structure.

Syntax

XCOPY "Path to root folder" "Path to destination folder"  /T /E

Example

XCOPY "C:\Users\fatiw\OneDrive\Desktop\My test Folder" D:\ /T /E

The first path is to a folder where I’ve placed the folder I want to copy the structure of. The second path is where I want to copy it to which is the root of the D drive.

/T is a switch and it’s what tells Xcopy to only copy the folder structure and not the files in it. The /E tells Xcopy to also include folders that are empty. You can, of course, run the command without the /E switch and the copied folder structure will include only those folders that had files inside them.

Xcopy is a pretty powerful tool and there’s documentation available for it that details the various switches that you can use with it. This tool isn’t for just copying folders. If you have a complicated copy command that you need to run, this tool is the first thing you should check out. It’s already present on your system, and it’s included in the system path so you can execute Xcopy commands directly from any folder.

What makes it a little inconvenient to use is that it’s a command-line tool and there’s no GUI for it. If you’re new to using the tool and still trying to figure out the correct syntax for a command, run it on test folders and files to avoid losing anything important.