Hi Kevin,

> Do you happen to have the batch?  I've been writing some xcopy lines,
> but have had problems finding a simple date-specific delete statement.

Here is what I use. It's a modified version  of what someone else posted. As
you can see I love to use "contant" definitions, that way any change in one
of those "parameters" needs only to be changed at the top. It also results
in shorter commandline later in the bachtfile. It simply deletes the oldest
directory with virus files, renames the directory names for the VirusDayX
directories until the all are one day later and the creates a new one for
today and moves all files into that directory.

The DTLOG program is something I whipped up in good old Pascal 6 for Dos
when there was no way to get a date and time into a batchfile commandline.
As of Windows 2000 there is now a way to get the date and time in a
parameter and use it. However, as I keep forgetting what those lines are....
and I have my DTLOG program... ;-)

Here's what my LOGFILE output looks like:
[....]
2004/10/14 00:01:00 : Rotating virus directories
2004/10/14 00:01:02 : Rotating VirusDay directories OK
            1024 File(s)     21.405.619 bytes
2004/10/15 00:01:00 : Rotating virus directories
2004/10/15 00:01:01 : Rotating VirusDay directories OK
             772 File(s)     16.306.664 bytes

Each virus mail has two files Q...SMD and  D...SMD. If you want more then 5
days history, simply extend the numer of lines from one Set RotDay... to the
next. And, of course, change the lines for Days5.

--------
@Echo Off
rem BB 10-mei-2004
rem E-mails met virussen niet automatisch verwijderen maar een X aantal
rem dagen bewaren. We doen dit door een aantal directories te gebruiken
rem en deze steeds verder op te schuiven door de naam te veranderen. De
rem oudste directory gooien we weg.
SET LOGFILE=C:\Beheer\Virrot.log
SET DTLOG=C:\Beheer\DTLog.exe

%DTLOG% %LOGFILE% Rotating virus directories

C:
cd \IMail\Spool\Virus

RD /S /Q VirusDay5
IF ErrorLevel 1 Goto ErrDel5
Set RotDay=4
Ren VirusDay4 VirusDay5
IF ErrorLevel 1 Goto ErrRot
Set RotDay=3
Ren VirusDay3 VirusDay4
IF ErrorLevel 1 Goto ErrRot
Set RotDay=2
Ren VirusDay2 VirusDay3
IF ErrorLevel 1 Goto ErrRot
Set RotDay=1
Ren VirusDay1 VirusDay2
IF ErrorLevel 1 Goto ErrRot
MD VirusDay1
Move *.SMD VirusDay1
IF ErrorLevel 1 Goto ErrMov1s
IF Exist *.GSC Move *.GSC VirusDay1
IF ErrorLevel 1 Goto ErrMov1g
%DTLOG% %LOGFILE% Rotating VirusDay directories OK
Dir VirusDay1 > Temp1
Find "File(s)" < Temp1 >> %LOGFILE%
Del Temp1
Goto Einde


:ErrDel5
%DTLOG% %LOGFILE% Error deleting VirusDay5 directory and/or files
Goto einde

:ErrRot
%DTLOG% %LOGFILE% Error Renaming VirusDay%RotDay% directory
Goto einde

:ErrMov1s
%DTLOG% %LOGFILE% Error moving SMD files to VirusDay1 directory
Dir . /a >> %LogFile%
Goto Einde

:ErrMov1g
%DTLOG% %LOGFILE% Error moving GSC files to VirusDay1 directory
Dir . /a >> %LogFile%
Goto Einde

:Einde
SET LOGFILE=
SET DTLOG=

--------

Groetjes,

Bonno Bloksma
.... Back up my hard drive? How do I put it in reverse?

----- Original Message ----- 
From: "Kevin Rogers" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, October 14, 2004 7:38 PM
Subject: Re: [Declude.Virus] Spool Dir


> Do you happen to have the batch?  I've been writing some xcopy lines,
> but have had problems finding a simple date-specific delete statement.
>
> Thanks
>
>
> Douglas Cohn wrote:
>
> >I personally do not like installing anything on my Imail servers.  That
said
> >I use a sinple dos batch file to delete everything that is X days old. I
run
> >it as a scheduled task daily.
> >
> >Doug
> >
> >-----Original Message-----
> >From: [EMAIL PROTECTED]
> >[mailto:[EMAIL PROTECTED] On Behalf Of Kevin Rogers
> >Sent: Wednesday, October 13, 2004 1:15 PM
> >To: [EMAIL PROTECTED]
> >Subject: [Declude.Virus] Spool Dir
> >
> >I was wondering what everyone does with the Imail\spool\virus directory.
Do
> >you delete all the files regularly?  I've got 7000 files in there since I
> >installed Declude (2 weeks ago).
> >
> >---
> >[This E-mail was scanned for viruses.]

---
[E-mail scanned at tio.nl for viruses by Declude Virus]

---
[This E-mail was scanned for viruses by Declude Virus (http://www.declude.com)]

---
This E-mail came from the Declude.Virus mailing list.  To
unsubscribe, just send an E-mail to [EMAIL PROTECTED], and
type "unsubscribe Declude.Virus".    The archives can be found
at http://www.mail-archive.com.

Reply via email to