How to Copy Folder Structure without Copying the Files

Earlier, we saw how to mirror the folder contents using various tools and methods. But, there are situations where you want to copy a folder structure without copying the files in those folders. For instance, you may want to replicate the directory structure of your expenses or accounting folders in order to organize them year-wise.

I have the following folder structure to store the documents pertaining to the financial year 2018-19. For the next financial year, I would want to copy the directory structure (without copying the files) to the parent folder named 2019-20 in order to maintain uniformity.

│   ├───Bank Reconciliation Statement
│   ├───Capital Gains
│   └───TDS
├───Bank Statements
│   ├───SB Accounts
│   └───Term Deposits
│   ├───Computer Accessories
│   ├───Salaries and Contract fees
│   │   ├───Staff salaries
│   │   └───Upwork fees
│   ├───Travel
│   └───Web Hosting
├───Income Tax
│   ├───Advanced Tax Receipts
│   ├───IT Returns
│   ├───Refund Orders
│   ├───Self Assessment Tax Receipts
│   └───Tax filing acknowledgement

The File Explorer doesn’t allow you to copy the folders without also copying the files. But, there are command-line methods and third-party tools that can easily replicate a directory structure. Let’s discuss the native command-line tools to replicate a folder structure.

Copy folder structure without copying the files

Using the XCopy command

The built-in XCopy command in Windows can copy the directory or directory tree (i.e., recursively). The switches /T /E make sure that only the folders (including empty folders) are copied without copying the files.

Open a Command Prompt window and use the following command-line syntax:

xcopy source destination /t /e

For example:

xcopy D:\Official\2018-19   D:\Official\2019-20 /t /e

If the destination folder doesn’t exist, you’ll be asked if the target/destination 2019-20 refers to a file name or directory name (F = file, D = directory) on the target. Press D to continue.

The 2018-19 folder structure is now replicated to 2019-20.

copy directory structure without files

  • /T Creates directory structure, but does not copy files. Does not include empty directories or subdirectories.
  • /T /E includes empty directories and subdirectories.

Using Robocopy

Using the built-in Robocopy, you can mirror the directory structure (without copying the files) using the following command-line syntax:

robocopy "D:\Official\2018-19" "D:\Official\2019-20" /e /xf *
  • /e – Copy subdirectories, including Empty ones.
  • /xf * – Excludes all files — denoted by the wildcard *

copy directory structure without files

Tip: If you want to exclude a particular folder(s), use the /xd switch.

Using PowerShell

Using PowerShell, you can mirror a directory tree (without copying the files) using the following command-line syntax:

Copy-Item -LiteralPath "D:\Official\2018-19" -Destination "D:\Official\2019-20" -Recurse -Filter {PSIsContainer -eq $true}

copy directory structure without files

Copy directory structure from another computer

To replicate the folder structure from another computer that’s not connected to your network, use one of the above methods in that system to mirror a directory tree.

Then, zip the mirrored folder using File Explorer’s Share tab or via the right-click menu — Send To → Compressed (zipped) folder option.

copy directory structure without files

Copy the zip file to your computer and extract the contents to a folder. The folder structure will be maintained when you extract it in the target computer.

One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right below. :)

About the author

Ramesh Srinivasan founded back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

4 thoughts on “How to Copy Folder Structure without Copying the Files”

    • I want to copy subfolders which has specific name like “High” into one folder. I have hundred’s of subfolders which many folders but I want to copy files inside “High” only. Is there any command which I can use?

  1. According to your example if I want to copy whole 2018-19 folder as it in 2019-20 folder what will be the command ?


Leave a Comment