Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want write a batch file that can copy a folder structure. This batch file would copy all folders in the source directory to the destination directory - the files themselves would not be copied.

For example, say there is a folder src with the following structure:


The tool would create a dest folder like the following:


Is it possible to accomplish this task using a batch file?

share|improve this question
up vote 14 down vote accepted


XCopy "src" "dest" /T

Just make sure it's not cyclical.

To include empty directories, add /E:

XCopy "src" "dest" /T /E
share|improve this answer
It copies files too, I only want directory structure to be copied. – Szere Dyeri Sep 26 '09 at 0:23
First post is corrected. – Stevoni Sep 26 '09 at 0:35
You can also add the /E switch which causes empty directories to be mirrored, too. – Joey Sep 26 '09 at 0:44
+1 for a solution that doesn't involve installing 3rd party programs. – RJFalconer Sep 26 '09 at 1:37
Thanks, this just saved me a lot of time. – mindless.panda Jun 23 '11 at 12:13
robocopy src dest /e /create

This partially achieves what you need. It will copy the directory structure and create zero length files as placeholders for the actual files. See more details here.

share|improve this answer

not a batch file but Total Commander can do this (with a little trick):

copy a directory and use the 'Only files of this type' option. enter *.nonsense (or any other non-existent file extension) in this field.

now Total Commander will create the entire directory structure of the source folder at the destination without copying any files.

share|improve this answer

you can just put |*.* into Total commander copy dialog and the folder structure will be copied without files

share|improve this answer
put |*.* in the "only files of this type" box – Remus Rigo Aug 17 '12 at 19:27

If you just want the file structure without the zero length files then it's

robocopy src dest /e /create /xf *.*


robocopy src dest /mir /create /xf *.*

share|improve this answer

Check 47 folders app , can create & copy folders structures in visual way..

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.