拷贝的目录,自己设置变量,日期自己改或者改成变量- @echo off
- set "olddir=d:\test" & set "newdir=d:\test2"
- for /f "delims=: tokens=1,2" %%a in ("%olddir%") do (set "o_d=%%a" &set "o_p=%%b")
- for /f "delims=: tokens=1,2" %%a in ("%newdir%") do (set "n_d=%%a" &set "n_p=%%b")
- setlocal ENABLEDELAYEDEXPANSION
- xcopy %olddir% %newdir% /L /s /e /y /d:04-01-2010 |findstr /v "个文件">1.txt
- xcopy %olddir% %newdir% /L /s /e /y /d:01-01-2010 |findstr /X /V /G:1.txt|findstr /v "个文件">2.txt
- xcopy %olddir% %newdir% /T /E /y
- for /f "delims=" %%i in (2.txt) do (
- set newfile=%%~pnxi
- set newfile=!newfile:%o_p%=%n_p%!
- copy "%%i" "%n_d%:!newfile!"
- )
复制代码
[ 本帖最后由 caruko 于 2010-4-2 18:02 编辑 ] |