Box 24

 Home   Infos   Tipps   Webmail   Humor   Polizei   Gästebuch   Downloads   Chat   Suchen   Feedback   Links 

 

 Anmelden/Login   Neuanmeldung/New User   Java Telnet Applet   Telnet   
 

Create a monthly digest

Here is a followup to the /dbackup command line switch:

I created two NT *.CMD batch files to create a monthly digest.

mergedigest.cmd
mergemonth.cmd - called by mergedigest.cmd

They use NT batch commands so they only run on NT/2000, not 95/98.

You can use wcEVENT to create with a monthly event to run the MERGEDIGEST.CMD batch file. It will merge digest.*.* files created by wcListServer with the /dbackup switch to monthly files in the format:

yyyymm.listname.digest

mergedigest.cmd:

@echo off
: file: mergedigest.cmd
: merge all digest.*.* files

for /f %%i in ('dir digest.*.* /a-d /odn /b') do call mergemonth %%i

mergemonth.cmd:

@echo off
: file: mergemonth.cmd
: merge single digest file to monthly digest file

if "%1" == "" goto :eof

: Localize variables to this batch file only

setlocal

: NT batch scripting trick to create calendar variables

for /f "tokens=2" %%i in ('date /t') DO set today=%%i
set month=%today:~0,2%
set day=%today:~3,2%
set year=%today:~6,4%

: create a merge file name using "yyyymm.listname.digest" format

for /f "tokens=2,3* delims=." %%i in ("%1") do set listname=%%i
set merge=%year%%month%.%listname%.digest

: if merge file does not exist, add header, otherwise append

if exist %merge% goto :append
echo # Creating new monthly digest: %merge%
echo ######################################################>>%merge%
echo Monthly Digest: %listname% (%month%/%year%)>>%merge%

:append
echo ######################################################>>%merge%

echo - Merging %1 to %merge%
type %1>>%merge%
erase %1

endlocal

© 2001 Hector Santos, http://www.santronics.com