Copy Folder Structure Without Files in Windows 11/10

Published by Nyau Wai Hoe - Updated on

When you copy files and folders in Windows, the system copies the entire contents of the folders, including files, subfolders, and their contents. However, there may be situations when you only need to copy the folder structure without any files, such as when you want to create a template for a new project or transfer folders to another location.

Fortunately, there are ways to copy the folder or directory structure (including subfolders or sub-directories) without copying the files inside, using command lines or third-party software. In this article, we will explore these options and provide step-by-step instructions on how to do it in Windows 11 or Windows 10.

Copy Folder Structure Without Files Windows 11 10

Copy folder structure without files using command lines

There are a few command-line options that you can use to copy only the folder structure tree without copying the files in Windows 11 or Windows 10.

Also see: How to move all files from subfolders to main folder

Use the XCOPY command in CMD

XCOPY is a built-in command in Windows that allows you to copy files and folders from one location to another. You can also use it to copy just the folder structure. The syntax for using XCOPY to copy the folder structure without files is as follows:

  1. Open Command Prompt by clicking the Start menu, searching for “Command Prompt,” right-clicking on “Command Prompt” and selecting “Run as administrator.”Command Prompt Run as Administrator
  2. Type the following command and press Enter:
    xcopy /t /e source destination

    Where “source” is the folder you want to copy the structure from and “destination” is the folder you want to copy the structure to. To save time, learn how to use “Copy as path” to quickly copy the path of any folder in Windows 11 or 10.copy folders without contents

  3. XCOPY will create a folder structure in the destination folder that is identical to the source folder, but without any files.

The “/t” switch specifies that only the folder structure should be copied, and not the files. The “/e” switch tells XCOPY to include empty directories in the copy operation. This means that XCOPY will copy all folders, including those that do not contain any files, to the destination folder.

Suggested read: How to Compare Two Folders in Windows 11

For example, let’s say you have a folder named “My Documents” located in “C:\Users\Alvin” that contains a complex folder structure with several subfolders. You want to create a copy of this folder structure without copying any files to a new folder named “My Documents Copy” located in “D:\Backup”. Here’s how you can do it using the XCOPY command:

xcopy /t /e "C:\Users\Alvin\My Documents" "D:\Backup\My Documents Copy"

XCOPY is a powerful command that can be used in various scenarios, such as creating backups or syncing files between two locations. It’s a quick and easy way to copy the folder structure without files, and it can save you a lot of time if you have a complex folder structure that you need to replicate.

Related issue: “This Folder is Empty” in Windows 11 (Fix)

Use the Robocopy command in CMD

Robocopy is another command-line tool that is available in Windows. It is designed to copy files and directories with more advanced features than XCOPY. You can also use it to copy just the directory structure without files. The syntax for using Robocopy to copy the folder structure without files is as follows:

  1. Run Command Prompt as administrator.Run Command Prompt as Administrator Windows 11
  2. Type the following command and press Enter:
    robocopy source destination /e /xf *

    Where “source” is the folder you want to copy the structure from and “destination” is the folder you want to copy the structure to.

  3. Robocopy will create a folder structure in the destination folder that is identical to the source folder, but without any files.

The “/e” switch specifies that all subdirectories, including empty ones, should be copied to the destination folder. The “/xf” switch specifies that all files should be excluded from the copy operation, ensuring that only the folder structure is copied. The “*” character after “/xf” specifies that all files should be excluded.

Useful tip: How to Batch Rename Files in Windows 11

For instance, the following command will copy the folder structure of “My Documents” to “My Documents Copy” without copying any files.

robocopy "C:\Users\Alvin\My Documents" "D:\Backup\My Documents Copy" /e /xf *

Robocopy is a powerful tool that can be used in various scenarios, such as creating backups or syncing files between two locations. It’s a quick and easy way to copy the folder structure without files, and it can save you a lot of time if you have a complex folder structure that you need to replicate.

Read nextSync Files Between Two Folders or Computers in Windows 11/10

Use Copy-Item in PowerShell

PowerShell is a powerful command-line tool that is built into Windows. It provides a way to automate administrative tasks and perform advanced system management functions. You can also use PowerShell to copy only the folder structure without files. The syntax for using Copy-Item in PowerShell to copy the folder structure without files is as follows:

  1. Open PowerShell by clicking the Start menu, searching for “PowerShell,” right-clicking on “Windows PowerShell” and selecting “Run as administrator.Windows 11 PowerShell Run as administrator
    Running PowerShell as an administrator is necessary to ensure that you have the appropriate permissions to access and copy the files and folders you need.
  2. Type the following command and press Enter:
    Copy-Item -LiteralPath "source" -Destination "destination" -Recurse -Filter {PSIsContainer -eq $true}

    Where “source” is the folder you want to copy the structure from and “destination” is the folder you want to copy the structure to.How to copy only folders without files

  3. PowerShell will create a folder structure in the destination folder that is identical to the source folder, but without any files.

For example, the following command will copy the folder structure of “Videos” to “VideosCopy” without copying any files.

Copy-Item -LiteralPath "C:\Users\Alvin\Videos" -Destination "D:\Backup\VideosCopy" -Recurse -Filter {PSIsContainer -eq $true}

Related question: Can I Manually Sort Files in a Folder in Windows 11?

The “-LiteralPath” parameter specifies the path to the source folder. It ensures that PowerShell interprets the source path literally and does not expand any wildcards or variables. This parameter is optional, but it can be useful if you have a path that contains spaces or special characters.

The “-Destination” parameter specifies the path to the destination folder. This parameter is required, and you must specify the path to the folder where you want to copy the folder structure without files.

The “-Recurse” parameter tells PowerShell to copy all subdirectories, including empty ones. This parameter is required if you want to copy the entire folder structure, including empty folders.

The “-Filter” parameter specifies that only directories should be copied, and not files. By default, Copy-Item copies both files and directories, so you need to use the “-Filter” parameter to specify that you only want to copy directories.

The filter expression “{PSIsContainer -eq $true}” checks whether the item being copied is a directory. If the item is not a directory, it will not be copied.

By using these parameters correctly, you can copy the directory tree without files in PowerShell quickly and easily. PowerShell also offers various additional parameters and options that you can use to customize your copy operation, making it a powerful and flexible tool for managing and copying your files and folders.

Copy empty folder structure with third-party software

While command lines are effective, they can be intimidating for some users. If you prefer a more user-friendly approach, there are several third-party software solutions that can help you copy a folder tree without files. One such software is TreeCopy, which is a free and open-source tool that can copy empty folder structures quickly and easily. Here’s how to use it:

  1. Download TreeCopy from the developer’s website.
    http://www.rjlsoftware.com/software/utility/treecopy/
  2. Unzip the downloaded file and launch TreeCopy.
  3. In the TreeCopy window, select the source folder whose structure you want to copy. You can do this by clicking the drop-down button next to the “Copy folders from” field and selecting the folder from the file browser.
  4. In the “Copy folders into” field, enter the path to the folder where you want to copy the folder structure. You can also click the drop-down button next to this field and select the destination folder from the file browser.
  5. Click the “Go” button to begin the folder structure copy operation.Copy folder tree without files Windows 11 10
  6. Once the operation is complete, check the destination folder to ensure that it contains the same folder structure as the original folder, but without any files.Copy directory structure without files using software

    TreeCopy is a simple and straightforward tool that can help you copy empty folder structures without the need for command-line tools or complex software. Give it a try and see if it meets your needs!

    Final thoughts

    Copying a folder tree without files is a simple task in Windows 11/10. Whether you prefer using command lines or third-party software, the methods we have discussed in this article will help you achieve your goal quickly and easily. By using these techniques, you can create templates, duplicate folder structures, or back up important data without wasting time copying unnecessary files. Try them out and see which one works best for you!

    Categories: Windows 10Windows 11

    Nyau Wai Hoe
    Nyau Wai Hoe is the Founder and Chief Editor of WindowsDigitals.com. With a degree in software engineering and over 12 years of experience in the tech support industry, Nyau has established himself as an expert in the field, with a primary focus on the Microsoft Windows operating system. As a tech enthusiast, he loves exploring new technologies and leveraging them to solve real-life problems.