- @echo off
- set source=D:\\test
- set target=E:\\my
- if not exists "%source%\\" md "%target%"
- xcopy/e/t "%source%" "%target%">nul
- for /f "delims=" %%i in ('dir/b/a-d/s "%source%\\"') do (
- echo. %%~nxi
- set nf=%%i
- call set nf=%%nf:%source%=%target%%%
- call copy nul "%%nf%%">nul
- )
- #仅创建目录结构
- for /D %%i in (*) do md c:\\%%i
- #该片段来自于http://www.codesnippet.cn/detail/140620134044.html
来源: http://www.codesnippet.cn/detail/140620134044.html