windows - Copy directory and create upper directory structure -


in windows (desktop, batch file, xcopy, robocopy) there way copy directory , have structure above created on destination?

for example, have directory of files @ c:\data\outlook\profiles\2013.

i want copy 2013 directory c:\copy want this: c:\copy\data\outlook\profiles\2013.

of course, can manually create structure before copy, looking in bulk.

here routine should copy target full path.

@echo off call :copywithpath "c:\data\outlook\profiles\2013" "c:\copy" exit /b %errorlevel%  :copywithpath <source> <target> md "%~f2\%~p1" && copy "%~f1" "%~f2\%~p1" exit /b %errorlevel% 

example of command values

md "c:\copy\data\outlook\profiles\" && copy "c:\data\outlook\profiles\2013" "c:\copy\data\outlook\profiles\" 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -