XCOPY的高級使用:指定日期并且用EXCLUDE排除指定文件
更新時間:2014年04月12日 23:20:23 作者:
這篇文章主要介紹了通過dos下的XCOPY命令實現復制指定日期并且用EXCLUDE排除指定文件的代碼,需要的朋友可以參考下
1.cmd到xcopyTime.bat所在目錄,執(zhí)行命令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
相關文章
批處理一鍵安裝JDK/一鍵安裝JRE和自動配置Java環(huán)境變量
對于java或安卓初學者來說,配置java環(huán)境變量是一件比較頭疼的事情,在此我向大家分享一個一鍵安裝JDK和自動配置java環(huán)境變量的bat批處理方法,需要的朋友可以參考下2018-01-01