CommandLine parameters to delete messages from mailbox
CommandLine parameters to delete messages from mailbox
Is there any CommandLine option to delete all messages from some specific mailbox? I need it to execute via BATCH file.
I use this to clear out deleted items on a regular basis.
You would just need to change the 4th line and replace "Deleted Items" to the root of the user mailbox like below
"c:\progra~1\mailenable\postoffices\poname\mailbox\username\"
I run this at the root of the postoffices folder so it look thru all po and users.
You would just need to change the 4th line and replace "Deleted Items" to the root of the user mailbox like below
"c:\progra~1\mailenable\postoffices\poname\mailbox\username\"
I run this at the root of the postoffices folder so it look thru all po and users.
Code: Select all
@echo off
cls
setlocal
Dir "Deleted Items" /S /B /O:-D /T:C > 2dellist.txt
For /f "delims=/" %%a in (2dellist.txt)do del "%%a\*.mai" /f /q
Endlocal
Exit
hi there,paarlberg wrote:I use this to clear out deleted items on a regular basis.
You would just need to change the 4th line and replace "Deleted Items" to the root of the user mailbox like below
"c:\progra~1\mailenable\postoffices\poname\mailbox\username"
I run this at the root of the postoffices folder so it look thru all po and users.
Code: Select all
@echo off cls setlocal Dir "Deleted Items" /S /B /O:-D /T:C > 2dellist.txt For /f "delims=/" %%a in (2dellist.txt)do del "%%a\*.mai" /f /q Endlocal Exit
you means u put at:
c:\program files\mailenable\postoffice ?
in order for me to let the batch delete all the deleted item folder in my whole server postoffice ?
so when i execute, it will auto get all "deleted item" folder message and delete it if i 100% copy your above code and paste on my server ?
If you want to test the script, place it in
C:\Program Files\Mail Enable\Postoffices\
and use the version below.. notice that line 5 from the original script is missing.
This will create a file called 2dellist.txt which will show all "deleted items" folders in all mailboxes. It will not delete anything..
If you run the original script I posted, then it will read the values in the 2dellist.txt file and delete any file with the .mai extension in those folders.
C:\Program Files\Mail Enable\Postoffices\
and use the version below.. notice that line 5 from the original script is missing.
Code: Select all
@echo off
cls
setlocal
Dir "Deleted Items" /S /B /O:-D /T:C > 2dellist.txt
Endlocal
Exit
If you run the original script I posted, then it will read the values in the 2dellist.txt file and delete any file with the .mai extension in those folders.
As I run the script, I had to remove *.MAI from the 5th line in order to run properly. Otherways, I got "Path not found" error:
Original line (BOLD is problematic):
For /f "delims=/" %%a in (2dellist.txt)do del "%%a\*.mai" /f /q
Modified line:
For /f "delims=/" %%a in (2dellist.txt)do del "%%a" /f /q
Original line (BOLD is problematic):
For /f "delims=/" %%a in (2dellist.txt)do del "%%a\*.mai" /f /q
Modified line:
For /f "delims=/" %%a in (2dellist.txt)do del "%%a" /f /q