How to clean up Badmail directory?

13,044

Solution 1

I tried to use del /q *.* and rd but no results. Several days the commands have been only preparing for deleting... What was the progress no one did know...

I decided to write a script so the bad files would be deleted one by one. At least with it you can see that the files are deleted. At start they are deleted slowly, but then the process increases speed of deletion.

The script is very simple:

for %i in (c:\inetpub\mailroot\badmail\\*.*) do del /q %i

In case you use batch file please add one more % to %i (%%i)

Good luck!

Solution 2

  1. Those files are undeliverable emails so just delete all of them. I don't see any point or value in keeping any of the files in the folder.

  2. Try deleting them from the command line.

Share:
13,044

Related videos on Youtube

Mxx
Author by

Mxx

Updated on September 18, 2022

Comments

  • Mxx
    Mxx over 1 year

    I was inherited this server so I'm not yet fully familiar with its setup.

    However, I noticed that C:\inetpub\mailroot\Badmail\ directory contains ~400,000 files. For now I do not want to delete the whole thing, only perhaps files older than 1/1/2012. I tried to use BadMailAdmin script, however when I run it on that dir, it errors out with:

    ERROR: C:\inetpub\mailroot\Badmail\: bytes total.
    Err.Number: 6
    Err.Description: Overflow
    Err.Source: Microsoft VBScript runtime error
    

    Possibly because of so many files in there. I tried to use just regular Windows Explorer. It takes ~5min to get dir listing, but when I select a bunch of files to delete it starting chewing 100% CPU of one core and does not comeback in 2 hours that I waited.

    If there any way to (quickly) delete some of these files?

    Note, this is NOT Exchange server, just regular IIS/smtp.

  • Mxx
    Mxx over 10 years
    To be on a safe side for now I'd like to delete only some of the oldest files. afaik you can't delete from command line based on date.
  • joeqwerty
    joeqwerty over 10 years
    To be on what safe side? What value could they have? What harm is there in deleting messages that won't ever be delivered? Are you planning on parsing every one of them to look for important information that you need to give to someone? IIS/SMTP will never deliver those messages so what do you plan to do with the ones you keep?
  • Mxx
    Mxx over 10 years
    Like I said before, I just inherited this server and not fully familiar with its configuration or what exactly it is hosting. Before I'm going to delete this whole directory I need to clear it with the client 1st. Until then my urgent task is to free up some disk space by deleting the oldest files there. Until the client OKs it, I WILL NOT delete the whole thing. This is not a discussion and I don't need to justify my requirements.
  • joeqwerty
    joeqwerty over 10 years
    I get it but it's clear that neither you nor the client understand the Badmail directory. What is it exactly that you're going to clear with them? What does that conversation look like? "Hey, client. There's a folder with a bunch of undeliverable email messages in it. These messages will never be delivered. There's no way of knowing what these messages are unless someone opens each one of them and parses it for useful information. Oh, and there are 400,000 of them." - It's OK to delete some as yet undefined number of these messages but it's not OK to delete all of them? That makes no sense.
  • joeqwerty
    joeqwerty over 10 years
    I don't mean any offense I'm just trying to understand your reticence in deleting all of them. They're of no value. IIS/SMTP will never deliver them, that's why they're in the Badmail folder in the first place. What is it that you think you're "being safe" by not deleting them? What do you think will happen if you delete them? Are you or someone else going to parse the ones that you keep to look for important information?
  • Mxx
    Mxx over 10 years
    For all I know they might want to look through them just to understand what/why was/is it bouncing. If it's some important transnational data they might want to know. If they don't care then obviously I'll nuke the whole thing.
  • Marcel Janus
    Marcel Janus over 10 years
    @Mxx If you first want to free up some disc space you can move this files to an external HDD or via FTP on an other server