@echo on
rem 将指定目录的所有文件及文件夹copy到指定目录下,只copy 7天内创建的或是7天内修改过的
rem author:perfectaction
set "src=d:\test\" rem 源目录路径
set "des=e:\test\" rem 目标路径
set "suffix=txt" rem 需要xcopy的文件后缀
set "dd=7" rem 只copy7天之内的文件
forfiles /p %src% /s /m *.%suffix% /d -%dd% /c "cmd /c dir @path /b/s >>%src%notcopylist_%suffix%.log"
if exist %src%notcopylist_%suffix%.log xcopy %src%*.%suffix% %des% /s /d /y /EXCLUDE:%src%notcopylist_%suffix%.log
if not exist %src%notcopylist_%suffix%.log xcopy %src%*.%suffix% %des% /s /d /y
if exist %src%notcopylist_%suffix%.log del %src%notcopylist_%suffix%.log
rem pause
rem 将指定目录的所有文件及文件夹copy到指定目录下,只copy 7天内创建的或是7天内修改过的
rem author:perfectaction
set "src=d:\test\" rem 源目录路径
set "des=e:\test\" rem 目标路径
set "suffix=txt" rem 需要xcopy的文件后缀
set "dd=7" rem 只copy7天之内的文件
forfiles /p %src% /s /m *.%suffix% /d -%dd% /c "cmd /c dir @path /b/s >>%src%notcopylist_%suffix%.log"
if exist %src%notcopylist_%suffix%.log xcopy %src%*.%suffix% %des% /s /d /y /EXCLUDE:%src%notcopylist_%suffix%.log
if not exist %src%notcopylist_%suffix%.log xcopy %src%*.%suffix% %des% /s /d /y
if exist %src%notcopylist_%suffix%.log del %src%notcopylist_%suffix%.log
rem pause