When you copy stuff in Windows, like files and folders, the system usually copies everything inside the folders too. But in some very rare occasions, you might only want to copy the way the folders are arranged, without the files inside. This can sometimes be useful when you’re setting up a new project or moving folders around and don’t need the files just yet.
Page Contents
Copy folder structure without files using command lines
There are a few tricks you can use with command lines in Windows 11 or Windows 10 to copy just the arrangement of folders, without the files.
Also see: How to move all files from subfolders to main folder
Use the XCOPY command in CMD
XCOPY is a popular cmdlet in Windows that is able to copy files and folders. You can also use it to copy only the folder structure.
- First, open Command Prompt as an admin by searching for “Command Prompt” in the Start menu, right-clicking on it, and choosing “Run as administrator.”
- Then, type this command and hit Enter:
xcopy /t /e source destination
Here, “source” is where you’re copying from, and “destination” is where you’re copying to. To make it easier, you can use “Copy as path” to quickly get the path of any folder.
- XCOPY will make a copy of the folder structure in the destination folder, but leave out the files.
The “/t” switch tells XCOPY to only copy the folder structure, not the files. The “/e” switch includes even the empty folders. So, XCOPY will copy every folder, even those without files, to the destination.
Suggested read: How to Compare Two Folders in Windows 11
For example, if you have a folder called “My Documents” in “C:\Users\Alvin” with lots of subfolders and you want to copy this setup to “D:\Backup\My Documents Copy” without the files, you would use this command:
xcopy /t /e "C:\Users\Alvin\My Documents" "D:\Backup\My Documents Copy"
Related issue: “This Folder is Empty” in Windows 11 (Fix)
Use the Robocopy command in CMD
Robocopy is another tool in Windows for copying files and folders, but with more features than XCOPY. You can also use it to copy only the folder structure. Here’s how:
- Start Command Prompt as administrator.
- Type this command and press Enter:
robocopy source destination /e /xf *
Here, “source” is the folder you’re copying from, and “destination” is where you’re copying to.
- Robocopy will then create a copy of the folder structure in the destination folder, but without the files.
The “/e” switch tells Robocopy to copy all subdirectories, even empty ones, and the “/xf” switch tells it to leave out the files. The “*” means to exclude all files.
Useful tip: How to Batch Rename Files in Windows 11
For example, to copy the “My Documents” folder structure to “My Documents Copy” without the files, you’d use:
robocopy "C:\Users\Alvin\My Documents" "D:\Backup\My Documents Copy" /e /xf *
Robocopy is another handy tool for backups or syncing, making it quick and easy to copy just the folder layout.
Read next: Sync Files Between Two Folders or Computers in Windows 11/10
How to use Copy-Item in PowerShell
Another way to copy only the folder structure in Windows is to just use the Copy-Item command in PowerShell, if you’re comfortable with it. We’ll show you how to use the cmdlet to copy just the folder layout without any of the files inside.
- First up, open PowerShell by going to the Start menu, type in “PowerShell,” right-click on “Windows PowerShell” and choose “Run as administrator.”
This step makes sure you’ve got the permissions you need to copy stuff around. - Next, type this command and hit Enter:
Copy-Item -LiteralPath "source" -Destination "destination" -Recurse -Filter {PSIsContainer -eq $true}
Here, “source” is the folder you’re copying from, and “destination” is where you’re copying to.
- PowerShell will make a copy of the folder structure in the destination, but it won’t copy the files.
For instance, to copy the layout of the “Videos” folder to “VideosCopy” without the files, you’d use this command:
Copy-Item -LiteralPath "C:\Users\Alvin\Videos" -Destination "D:\Backup\VideosCopy" -Recurse -Filter {PSIsContainer -eq $true}
Linked question: Can I sort files manually in a Windows 11 folder?
To help you understand a little bit more about the command line used, here are some explanation of what it actually does:
The “-LiteralPath
” parameter means PowerShell takes your source path exactly as you type it, spaces, special characters, and all.
The “-Destination
” is where you’re aiming to copy the folder structure, without the files.
“-Recurse
“, on the other hands, makes sure all subdirectories (even empty ones) get copied, and “-Filter
” ensures only folders, not files, are copied.
Lastly, the filter “{PSIsContainer -eq $true}
” checks if the item is a folder. If it’s not, it won’t be copied.
Copy empty folder structure with other software
While command lines work well, they can be a bit complicated and difficult to understand. If you like a friendlier approach, there are some other software options out there that provides a GUI. TreeCopy is one such tool that’s free, easy to use, and can copy folder structures without the files. Here’s how:
- Download TreeCopy from the developer’s site.
http://www.rjlsoftware.com/software/utility/treecopy/
- Open the file you downloaded and start TreeCopy.
- Pick the folder you’re copying from by clicking next to “Copy folders from” and choosing the folder.
- Put in the path for where you’re copying to in “Copy folders into.” You can also browse for the folder here.
- Hit “Go” to start copying the folder structure.
- Once the operation is completed, check the destination folder to see whether it contains the same folder structure as the original folder, but without any files.
Just one more thing
Whatever you try to do with your original folder(s), although most methods mentioned in this guide don’t involve deletion of any folders, make sure to make a backup copy of them so if you mess up any steps, you can easily restore your files. Better be safe than sorry.