以前备份程序,大多是直接将程序所在目录包括其下的子目录都进行打包压缩,所以会包含很多不需要的文件在备份的包 中,增加文件的大小.比如象VC项目的DEBUG目录等,小的10多M,大的几十M,这些经重新编译后会自动产生,没有必要进行备份.以下是用XCOPY 备份的脚本.备份之前先确定哪些类型(即文件扩展名)的文档需备份,备份之后如再进行压缩,目录备份文件就更精简了.

把以下这些脚本指令贴在批处理文件中,设置相应源目录和目标目录的参数后运行即可.

BACKUP.CMD

SET VS2003FLG=
SET VCFLG=

SET DELPHIFLG=REM

 REM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
REM %  以下是VC项目源代码文件备份批处理指令                                 %
REM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

REM *************************************************************************
REM * SOURCE_PATH:      为需备份的源目录环境变量                            *
REM * BACKUP_DEST_PATH: 为备份的目标目录环境变量                            *
REM * REM_FLG:          这是命令执行标志环境变量,值为REM 可使命令为注释状态 *
REM *                   如设为空,则命令为有效状态
REM *************************************************************************

SET SOURCE_PATH=D:"Project"vc"
SET BACKUP_DEST_PATH=E:"TEMP"CODEBK"VC
SET REM_FLG=%VCFLG%

%REM_FLG%  XCOPY  %SOURCE_PATH%*.APS   /S /E /I /H /R /Y   %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.H     /S /E /I /H /R /Y   %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.CPP   /S /E /I /H /R /Y   %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.CLW   /S /E /I /H /R /Y   %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.PLG   /S /E /I /H /R /Y   %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.OPT   /S /E /I /H /R /Y   %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.RC    /S /E /I /H /R /Y   %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.DSP   /S /E /I /H /R /Y   %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.DSW   /S /E /I /H /R /Y   %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.NCB   /S /E /I /H /R /Y   %BACKUP_DEST_PATH%

%REM_FLG%  XCOPY  %SOURCE_PATH%*.RC2   /S /E /I /H /R /Y   %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.BMP   /S /E /I /H /R /Y   %BACKUP_DEST_PATH%

REM 以下为程序运行时所需配置或数据文件

%REM_FLG%  XCOPY  %SOURCE_PATH%*.Config   /S /E /I /H /R /Y  %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.ICO      /S /E /I /H /R /Y  %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.XML      /S /E /I /H /R /Y  %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.SQL      /S /E /I /H /R /Y  %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.INI      /S /E /I /H /R /Y  %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.XLS      /S /E /I /H /R /Y  %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.DOC      /S /E /I /H /R /Y  %BACKUP_DEST_PATH%
%REM_FLG%  XCOPY  %SOURCE_PATH%*.TXT      /S /E /I /H /R /Y  %BACKUP_DEST_PATH%

posted on 2008-08-19 06:55  大熊猫  阅读(378)  评论(0编辑  收藏  举报