Discussion:
batch to zip folder
(too old to reply)
big
2010-06-26 10:01:47 UTC
Permalink
I have a logs folder.
A software generates every day inside this folder a new folder with
this syntax yearmonthday, (20100626).
I would like, every first day of month, with a scheduled task, that
all the folder of the previous month are zipped.
Someone could suggest me a scrip ready to use?
Bonno Bloksma
2010-07-05 13:39:29 UTC
Permalink
Hi,
Post by big
I have a logs folder.
A software generates every day inside this folder a new folder with
this syntax yearmonthday, (20100626).
I would like, every first day of month, with a scheduled task, that
all the folder of the previous month are zipped.
Someone could suggest me a scrip ready to use?
Here some parts of my midnight script

rem creating date variabels
set dow=%date:~0,2%
set dd=%date:~3,2%
set mm=%date:~6,2%
set yy=%date:~11,2%
set year=%date:~9,4%

rem General Vars
SET LogDir=\Beheer\Logs
SET LogTo=%LogDir%\Midnight.log
SET ZIPLOG="%LogDir%\Logs %year%-%mm%.ZIP"
SET W3Log=%WinDir%\System32\LogFiles\w3SVC1\ex%yy%%mm%%dd%.log

[....]
ZIP -m9 -j %ZipLog% %W3Log% etc. etc.
IF ErrorLevel 1 Echo %Date% %Time% Error ZIPping logfiles >> %LogTo%

The ZIP command comes in my case from the UnxUtils but there are probably better/newer tools today.
It's just that this one does what I need it to do so never changed it.

Bonno Bloksma

Loading...