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:
src srcafile1 srcafile2 srcabfile1 srcc
The tool would create a
dest folder like the following:
dest desta detsab destc
Is it possible to accomplish this task using a batch file?
XCopy "src" "dest" /T
Just make sure it’s not cyclical.
To include empty directories, add /E:
XCopy "src" "dest" /T /E
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.
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.
you can just put
|*.* into Total commander copy dialog and the folder structure will be copied without files