這篇文章主要介紹了通過(guò)dos下的XCOPY命令實(shí)現(xiàn)復(fù)制指定日期并且用EXCLUDE排除指定文件的代碼,需要的朋友可以參考下
1.cmd到xcopyTime.bat所在目錄,執(zhí)行命令xcopyTime sourceFolder DestinationFolder dateTime
2.EXCLUDE.txt是排除的對(duì)象,不復(fù)制其中羅列的文件或文件夾
例子:
F:\bat>xcopyTime E:\workspace F:\website\ 06-30-2010
EXCLUDE.txt內(nèi)容,在下面的線里面
------------------------------
.classpath
.class
.log
------------------------------
代碼如下:
@echo off
rem xcopy2.BAT transfers all files in all subdirectories of
rem the source drive or directory (%1) to the destination
rem drive or directory (%2)
rem lastModifyTime (%3)
xcopy %1 %2 /s /d:%3 /exclude:EXCLUDE.txt /y
if errorlevel 4 goto lowmemory
if errorlevel 2 goto abort
if errorlevel 0 goto exit
:lowmemory
echo Insufficient memory to copy files or
echo invalid drive or command-line syntax.
goto exit
:abort
echo You pressed CTRL+C to end the copy operation.
goto exit
:exit
==================================================================
.classpath
.class
.log
更多信息請(qǐng)查看IT技術(shù)專欄