Solutions Log by Dan Reiland

25Aug/090

Mirror a Directory Structure Using the Command Line

Issue:
You need to mirror the directory structure (but not contents) for a tree.

Resolution:
Execute the following command from the root of your source directory. Adjust the destination variable to suit your tastes: %i will match the first token, %j the second, %k the third, and %l will match everything else.

for /F "tokens=1,2,3* delims=\" %i in ('dir /Ad /B /N /S') do mkdir t:\dest\%l

Reference: http://www.dostips.com/DtTipsStringManipulation.php