windows tips cmd提示符下 日期及文件压缩 脚本

@echo off
echo "=====================start  winrar yesterDays'file ......================="

set Today=%date:~0,4%-%date:~5,2%-%date:~8,2%
 
set /a Todayyes= %date:~0,4%%date:~5,2%%date:~8,2%-1

set /a Todaytwoday= %date:~0,4%%date:~5,2%%date:~8,2%-2

set   yesday=%Todayyes:~6,2%
set   twoday=%Todaytwoday:~6,2%


set   yesterDays=%date:~0,4%-%date:~5,2%-%yesday%
set   twoDaysago=%date:~0,4%-%date:~5,2%-%twoday%

echo %Today%
echo %yesterDays%
echo %twoDaysago%

echo  "===================== yesterDays'file  path================="
set yesterDaysLogRarfile=E:\logs\webonline\zhifu\torque.log.%yesterDays%.rar
set yesterDaysfile= E:\logs\webonline\zhifu\torque.log.%yesterDays%

echo %yesterDaysLogRarfile%
echo %yesterDaysfile%

 

echo  "=====================twoDaysago'file  path================="
set twoDaysagoLogRarfile=E:\logs\webonline\zhifu\torque.log.%twoDaysago%.rar
set twoDaysagofile=E:\logs\webonline\zhifu\torque.log.%twoDaysago%

echo %twoDaysagoLogRarPath%
echo %twoDaysagofile%


c:
cd C:\Program Files (x86)\WinRAR
if exist   %yesterDaysfile%      Rar.exe a -ep1  -s -m1 %yesterDaysLogRarfile% %yesterDaysfile%

 

echo "=======check twodaysago'file ,if exist the twodaysago'rar file ,then delete log================="


if exist %twoDaysagoLogRarfile%   del %twoDaysagofile%


echo "==========all ok=========="

exit


 ============

 

@echo off
echo "=====================start  winrar yesterDays'file ......================="

set Today=%date:~0,4%-%date:~5,2%-%date:~8,2%
 
set /a Todayyes= %date:~0,4%%date:~5,2%%date:~8,2%-1

set /a Todaytwoday= %date:~0,4%%date:~5,2%%date:~8,2%-2

set   yesday=%Todayyes:~6,2%
set   twoday=%Todaytwoday:~6,2%


set   yesterDays=%date:~0,4%-%date:~5,2%-%yesday%
set   twoDaysago=%date:~0,4%-%date:~5,2%-%twoday%

echo %Today%
echo %yesterDays%
echo %twoDaysago%

echo  "===================== yesterDays'file  path================="
set yesterDaysLogRarfile=E:\logs\webonline\zhifu\core.log.%yesterDays%.rar
set yesterDaysfile= E:\logs\webonline\zhifu\core.log.%yesterDays%

echo %yesterDaysLogRarfile%
echo %yesterDaysfile%

 

echo  "=====================twoDaysago'file  path================="
set twoDaysagoLogRarfile=E:\logs\webonline\zhifu\core.log.%twoDaysago%.rar
set twoDaysagofile=E:\logs\webonline\zhifu\core.log.%twoDaysago%

echo %twoDaysagoLogRarPath%
echo %twoDaysagofile%


c:
cd C:\Program Files (x86)\WinRAR
if exist   %yesterDaysfile%      Rar.exe a -ep1  -s -m1 %yesterDaysLogRarfile% %yesterDaysfile%

 

echo "=======check twodaysago'file ,if exist the twodaysago'rar file ,then delete log================="


if exist %twoDaysagoLogRarfile%   del %twoDaysagofile%


echo "==========all ok=========="

exit


 

 

你可能感兴趣的:(windows tips cmd提示符下 日期及文件压缩 脚本)