windows 下项目打包、备份、覆盖、md5check

工具从网络自行下载,目前我存储在网盘上,可下载后调用

  1. 更新包打包、创建md5,压缩成.zip
  2. 现有项目按日期备份
  3. 覆盖项目并做md5check
    @echo off
    
    rem =================文件变量=============================================
    set zip=D:\tools\7za.exe
    set md5=D:\tools\FileCheck_MD5.exe
    
    ::file_package
    cd /d %~pd0
    %md5% -create %~pd0app -k %~pd0app\md5.txt
    %zip% a -tzip %~pd0app.zip %~pd0app\ -r
    
    ::项目app
    ::判断旧解压包是否存在,存在删除
    ::更新包名:D:\server_new\app.zip
    ::解压目录:D:\server_new\app
    ::判断更新包是否存在,存在就解压更新包到指定目录
    
    ::file_ready
    if exist "D:\server_new\app" (rd /s /q  D:\server_new\app) >nul
    if not exist "D:\server_new\app.zip" (exit) >nul
    if exist "D:\server_new\app.zip" (%zip% x D:\server_new\app.zip -oD:\server_new\) >nul
    
    ::file_backup
    ::exclude log files and/or folders
    echo .log > exclude.txt
    echo log >> exclude.txt
    xcopy /r /d /i /s /y /q /exclude:exclude.txt D:\app D:\server_bak\app"%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%"
    del exclude.txt
    
    ::file_update
    ::判断更新目录是否存在,更新目录:D:\server_new\app
    ::若存在就将解压文件覆盖到指定目录
    if not exist "D:\app" (exit) 
    if not exist "D:\server_new\app" (exit)
    xcopy /r /d /i /s /y D:\server_new\app D:\app\
    %md5% -check D:\app\ -k D:\server_new\app\md5.txt > D:\server_new\md5_check.log
    win_tools.bat
  4.  Mysqldump
    set YMDT=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%
    mysqldump --opt -u root --password=passwd db > D:\dbbak\db_%YMDT%.sql
posted @ 2017-07-08 18:43  Mr黄瑞  阅读(312)  评论(0编辑  收藏  举报