Sysadmin
 -> 
Windows
 -> 
scripts
 -> 
Logrotate using 7z
 
... 

Logrotate using 7z

archiving old files (logs)

echo off
rem %1 - path %2- mask %3 - archive name %4 - days old
if "%~1"=="" goto usage
if "%~3"=="" goto usage
forfiles /p "%~1" /m "%~2" /d -%~4 /c "cmd /c echo @file @fdate @ftime & 7za a %~3.7z @file && del /f /q @file"
goto quit
:usage
echo pack all files in path %%1 by mask %%2 with %%4 days old
echo to archive %%3.zip (for dated archive name use %%date:~8,2%%%%date:~3,2%%%%date:~0,2%%)
:quit

forfiles.exe доступен в серверной линейке Windows и Vista.

 

 

... 
Site Map
News
Search






 Recomended screen size 1024x768 http://www.collection.com.ua webmaster © 2002-2006