This batch script can backup full project files, adding date time to archive name, jar files are excluded.
My date Format is:
>E:\wwwroot>echo exit|cmd /q /k prompt $D $T
>2008-09-19 星期五 16:37:41.18
Please modify codes to meet your need.
echo off
@For /F "tokens=1,2,3 delims= " %%A in ('echo exit^|cmd /q /k prompt $D $T') do @(
Set DateStr=%%A
Set WeekStr=%%B
Set TimeStr=%%C
)
@For /F "tokens=1,2,3 delims=-" %%A in ('echo %DateStr%') do @(
Set Year=%%A
Set Month=%%B
Set Day=%%C
)
@For /F "tokens=1,2,3 delims=:" %%A in ('echo %timeStr%') do @(
Set Hour=%%A
Set Minute=%%B
Set Second1=%%C
)
@echo Second1 = %Second1%
@For /F "tokens=1 delims=." %%A in ('echo %Second1%') do @(
Set Second=%%A
)
@rem @echo DateStr = %DateStr%
@rem @echo TimeStr = %TimeStr%
@rem @echo Second1 = %Second1%
@rem @echo Year = %Year%
@rem @echo Month = %Month%
@rem @echo DAY = %Day%
@rem @echo Hour = %Hour%
@rem @echo Minute = %Minute%
@rem @echo Second = %Second%
@rem @echo ProjectFolder%Year%%Month%%Day%_%Hour%%Minute%%Second%.7z
@rem @Set FilePath=ProjectFolder%%Year%%%%Month%%%%Day%%_%%Hour%%%%Minute%.7z
@rem @"E:\Program Files\7-Zip\7z.exe" a -t7z ProjectFolder%Year%%Month%%Day%_%Hour%%Minute%%Second%.7z "E:\wwwroot\projectfolder\" -xr!*.jar
@echo on
@Set FilePath=ProjectFolder%Year%%Month%%Day%_%Hour%%Minute%%Second%.7z
@"E:\Program Files\7-Zip\7z.exe" a -t7z %FilePath% "E:\wwwroot\projectfolder\" -xr!*.jar
订阅:
博文评论 (Atom)
没有评论:
发表评论