To use robocopy copy folder structure only, add /e /xf * to the command so Robocopy creates the directory tree without transferring file contents. For example, robocopy "C:\Source" "D:\Destination" /e /xf * tells Robocopy to include subfolders and exclude files. [1] Learn more in How to Copy a Folder Structure Without Files.
The /e switch includes subfolders, even empty ones, while /xf * excludes files. [1] The result is a matching set of folders at the destination, not copies of the files inside them. [1] For instance, if the source contains Projects\Drafts and Projects\Final, those folders can be reproduced at the destination while their documents stay behind.
This is useful when you want an empty folder layout to organize new work, prepare a project area, or recreate a directory tree on another drive. Keep the command focused on creating folders: the goal is to mirror the paths, not move or duplicate file contents.
Check the source and destination first
Before you run Robocopy, verify the full source and destination paths so the folder tree comes from the right place and is created where you expect. If either path includes spaces, enclose the entire path in quotation marks; for example, "C:\Project Files\Drafts" keeps the spaces inside one path.[1]
Check each path
Read the source path first and confirm it points to the folder tree you want to reproduce. For example, if you want the folders under C:\Project Files\Drafts, make sure you have not selected a neighboring folder such as C:\Project Files\Archive by mistake.
Then check the destination path separately. It should name the location where you want the new folders to appear, such as D:\Work\Drafts; take a moment to verify the drive and parent folder before continuing.
Pick a clean destination
For your first run, use a new or empty destination folder. That makes it easier to inspect what Robocopy created without mixing the result with folders that were already there.
For example, you could create D:\Work\Drafts-Test as the destination, then review that location after the command finishes. Avoid choosing an existing project folder if you are unsure what it already contains.
Run the command in Command Prompt
Open Command Prompt from the Start menu. In the window, enter
robocopy "C:\Source" "D:\Destination" /e /xf *, replacingC:\SourceandD:\Destinationwith your actual paths. For example, if your folders areC:\Projects\ArchiveandD:\Backup\Archive, use those paths in the command instead. [1]Keep
/ein the command to include subdirectories, and use/xf *to exclude files. [1] Robocopy will then create the matching folders under the destination without copying file contents. [1]Press Enter to run the command. When it finishes, open the destination in File Explorer and inspect the resulting folders. For example, check that expected subfolders appear and that the destination contains no copied files. [1]
If the result does not look right, compare the destination tree with the source and check that you entered the intended paths before running the command again.
Review the command before you press Enter
Before you press Enter, check each path and make sure the command is set up to create folders without transferring files. A small typo in a drive letter or folder name can send the new structure somewhere unexpected, so read the command from left to right.
Check the two paths
Compare the source path with the folder tree you mean to reproduce, then check that the destination is the location you intend to use. For example, if you meant to use D:\Projects\Archive but typed D:\Project\Archive, Robocopy may point to a different folder. Keep the source and destination distinct; do not use the source itself as the destination.
Check each pair of quotation marks, too. If a quote is missing or sits in the wrong place, fix it before running the command.
Confirm what the command will do
Review the switches at the end of the command: /e includes subfolders, including empty ones, and /xf * excludes files.[1] Together, those switches direct Robocopy to create the folder structure without copying file contents. Do not add unrelated switches just because they appear in another Robocopy example; extra options can change the operation.
As a final check, read the source path, destination path, and switches separately. If the destination is correct and the command still ends with /e /xf *, you are ready to run it.
What the Robocopy switches do
The table shows how the command creates a matching folder tree while excluding file contents.
Command part | What it does |
|---|---|
Source path | Identifies the folder tree to reproduce |
Destination path | Sets where the new folders will appear |
| Includes subfolders, even empty ones |
| Excludes files |
Frequently Asked Questions
What Robocopy command copies only the folder structure?
Use robocopy "C:\Source" "D:\Destination" /e /xf *, replacing the example paths with your own. The /e switch includes subfolders, even empty ones, while /xf * excludes files. Robocopy creates the matching directory tree at the destination without transferring the files inside it.
Does Robocopy include empty subfolders with /e /xf *?
Yes. The /e switch includes subfolders, including empty ones, and /xf * excludes files. Together, they create the folder structure at the destination without copying file contents. After the command finishes, inspect the destination in File Explorer to check that the expected folders appear and no files were copied.
Do I need quotation marks around Robocopy paths with spaces?
Yes. Enclose each full path in quotation marks when it contains spaces so Robocopy treats it as one path. For example, write "C:\Project Files\Drafts". Before running the command, check the source and destination paths, including their drive letters, folder names, and quotation marks.
How can I check that Robocopy created the right folder tree?
After the command finishes, open the destination in File Explorer. Check that expected subfolders appear and that the destination contains no copied files. If a folder is missing or the destination is unexpected, compare the destination tree with the source and review the paths before running the command again.
Use this command when you need empty folders
Remember the pattern for an empty folder tree: robocopy "source" "destination" /e /xf *.[1] For example, use it when you need to recreate project folders on another drive without bringing over the documents inside them. The command’s scope is the directory structure, not a copy of the files; use a different approach if you need both the folders and their contents. Related reading: How to Copy Folder Structure With Files in Windows.
After Robocopy finishes, open the destination in File Explorer and check that the expected folders and subfolders are there. For example, if the source has Projects\2024\Invoices, confirm that path appears in the destination and that the files themselves were not copied. If a folder is missing or the destination is not what you expected, pause and review the paths before running the command again. This final check helps you confirm the result matches the task: empty folders only.
