How to make an empty copy of a folder structure in Windows

I found myself needing to copy a folder structure in Windows, but I didn’t need any of the files contained within.

One way of doing this would be copying and pasting it to where I wanted, then navigating the folders and manually deleting all of the files, but the copy operation would be longer than necessary, due to it copying the contents of all of the folders & the deletion of the files after the copy would take even more time.

So, I recommend using a command line utility called xcopy.

Xcopy has been around for a very long time & is an extended version of the copy command.

So, back to it. Let’s say we want to copy the structure of FolderA including all it’s sub-folders recursively and call the copy FolderB. To do that we can fire up the command prompt or powershell and run the following command

xcopy /t /e FolderA FolderB

It will then ask if the target is a file or directory, we want to press D for our scenario.

And that’s it. We are done.

In the above command the /t means copy the directory structure without files and the /e means we want it to copy empty folders too.

If you want a complete list of switches, then you can run:

xcopy /?

Hope this helps someone. Please like & share & I look forward to reading any comments.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s