Page 1 of 1

[Windows] Copy directory structure only

Posted: Mon Jul 09, 2018 3:27 pm
by gilthanaz
[Problem]
I want to create an exact copy of the directory structure of drive to another drive, without copying any files. "xcopy" has failed the job because some path names are longer than 255 chars (this triggers an out of memory error).

[Solution]
More recent versions of windows come with "robocopy", which can handle the job:

robocopy a: b: /e /xf * /W:0 /R:0

/e: Copy empty directories
/xf *: Exclude all files
/W:0 Wait zero seconds
/R:0 Do not retry (0 times) if there is an error (e.g. permission denied).

This command did exactly what I wanted and re-created the majority of the structure with the exception of some known access issues! :)