XCOPY的高级使用:指定日期并且用EXCLUDE排除指定文件
程序员文章站
2022-06-16 15:54:10
1.cmd到xcopytime.bat所在目录,执行命令xcopytime sourcefolder destinationfolder datetime 2.exclud...
1.cmd到xcopytime.bat所在目录,执行命令xcopytime sourcefolder destinationfolder datetime
2.exclude.txt是排除的对象,不复制其中罗列的文件或文件夹
例子:
f:\bat>xcopytime e:\workspace f:\website\ 06-30-2010
exclude.txt内容,在下面的线里面
------------------------------
.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
2.exclude.txt是排除的对象,不复制其中罗列的文件或文件夹
例子:
f:\bat>xcopytime e:\workspace f:\website\ 06-30-2010
exclude.txt内容,在下面的线里面
------------------------------
.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