Here's a VBScript we use.  I'd recommend only running this script with
the SMTP / Queue Manager services stopped.  Running the script while
file operations are occuring is a bad idea, as you may delete legit
emails.

on error resume next

Set fso=CreateObject("Scripting.FileSystemObject")
set fsoFile=CreateObject("Scripting.FileSystemObject")


For Each f In fso.GetFolder("c:\imail\spool\").Files

        if Left(f.name,1) = "D" then
        
        wscript.echo "D File: " & f.name
                
                if fso.FileExists("c:\imail\spool\" & Replace(f.name,
"D", "Q", 1, 1)) = FALSE then

        
                        if fso.FileExists("c:\imail\spool\" &
Replace(f.name, "D", "T", 1, 1)) = FALSE then

                                fso.DeleteFile "c:\imail\spool\" &
f.name

                                wscript.echo "-- Deleted"
                        
                        else
                
                        set TFile = fsoFile.GetFile("c:\imail\spool\" &
Replace(f.name, "D", "T", 1, 1))
                
                        

                                if DateDiff("n", TFile.DateLastModified,
Now()) > 60 then 
                                
                                'wscript.echo TFile.DateLastModified
                                
                                TFile.Delete
                                fso.DeleteFile "c:\imail\spool\" &
f.name
                                wscript.echo "-- Deleted (D&T)"


                                end if
                        
                        end if


                end if
        end if

Next

Set fso=Nothing 


Thanks!

-----

Jay Sudowski // Handy Networks LLC

Director of Technical Operations
Providing Shared, Reseller, Semi Managed and Fully Managed Windows 2003
Hosting Solutions
Tel: 877-70 HANDY x882 |  Fax: 888-300-2FAX

www.handynetworks.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brad Morgan
Sent: Thursday, November 18, 2004 11:34 AM
To: [EMAIL PROTECTED]
Subject: RE: [IMail Forum] Spool Directory Mess

>
> ISPLCLN will work but it isn't smart enough to just take orphaned "D" 
> files.
> It is set to remove by date and will take all (based on the switches 
> used)
>

Try the following Perl scripts.  If run with no argument, they will need
a minor tweak to run on your system.  I've got Cygwin installed but they
should work with Activestate Perl.

#!/usr/bin/perl
#
# Delete D*.SMD files without a cooresponding Q*.SMD file.
#
if (@ARGV == 0) {
        @ARGV = glob "/cygdrive/i/imail/spool/virus/D*.SMD";
    }
foreach $arg (@ARGV) {
    $arg2 = $arg;
    $arg2 =~ s/\/D/\/Q/;
    if (! -e $arg2) {
        print $arg, "\n";
        unlink $arg;
    }
}

#!/usr/bin/perl
#
# Delete Q*.SMD files without a cooresponding D*.SMD file.
#
if (@ARGV == 0) {
        @ARGV = glob "/cygdrive/i/imail/spool/virus/Q*.SMD";
    }
foreach $arg (@ARGV) {
    $arg2 = $arg;
    $arg2 =~ s/\/Q/\/D/;
    if (! -e $arg2) {
        print $arg, "\n";
        unlink $arg;
    }
}


To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive:
http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/



To Unsubscribe: http://www.ipswitch.com/support/mailing-lists.html
List Archive: http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Knowledge Base/FAQ: http://www.ipswitch.com/support/IMail/

Reply via email to