- @echo off
- set "SrcFolder1=D:\A"
- set "SrcFolder2=D:\B"
- set "DstFolder=E:\B"
-
- for /r "%SrcFolder2%\" %%i in (*) do (
- set "file=%%i"
- setlocal enabledelayedexpansion
- if not exist "!file:%SrcFolder2%=%SrcFolder1%!" (
- for %%j in ("!file:%SrcFolder2%=%DstFolder%!") do (
- endlocal
- md "%%~dpj" 2>nul
- copy "%%i" "%%~dpj"
- )
- ) else endlocal
- )
- pause
复制代码
|