Skip that last reply, I'm a terrible reader.

immsgexp will traverse a directory tree without a problem:

    C:\IMail\immsgexp.exe -tE:\ -d7 -mSpam.mbx

This will search the entire E: drive for any file called Spam.mbx and then clean it out. to 7 days worth of messages.  I've been doing this for several years without issue.

Matt



Colbeck, Andrew wrote:
Dean, I'm not sure if this is close to what you're looking for, but in
addition to the forfiles command, the "for" command that is built into
the command shell can be very handy, particularly if you're only going
one directory deep.

Check it out:

for /?

For example, you can do this to loop through the directories:

For /D %i in (c:\*.*) do @echo %i

Which will print out all of the directories in your c:\ drive's root.

The "/D" part of that can change to various other letters depending on
what you want to loop through.

Another example; if you want to just loop through the files in a given
folder you don't use any parameter there:

for %i in (c:\imail\spool\d*.smd) do @echo %i

Which will print out all of the files that look like messages in your
IMail spool folder.

You mentioned that you wanted just file or folder names or some
variation, and that can be done as well.  I should explain that the %i
in my examples is just an arbitrary letter I used for the counting and I
used it to match the output of the "for /?" command.  You can use any
letter you like, and if you use the "for" command in a batch file, you
need to "escape" the % by repeating it, i.e. use %%i instead of %i, or
%%X instead of %X.

With the "for" command you can use expand that %i variable in a
path/file name to the fully qualified path, the filename, the extension,
or a combination of them.

Use the "for /?" for the full examples, but here's a real-world example.
In one folder, I wanted to replace all of the web log files for last
month with one zip file per log file (e.g. zip up the log file into the
appropriately named zip file).

This was very easy for the "for" command:

for %i in (w30607??.log) do wzzip -mex %~ni.zip %i

The ~n modified the %i so that although %i became w3060701.log the
parameters passed to wzzip looked like:

wzzip -mex w3060701.zip w3060701.log

... And so on for all the log files found.

I know that doesn't help with the spam removal part of your task, but I
hope it helps you with the ability to run a script against the folders
and files you want.

Andrew 8)
 

  
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On 
Behalf Of Dean Lawrence
Sent: Thursday, August 24, 2006 1:43 PM
To: declude.junkmail@declude.com
Subject: [Declude.JunkMail] OT: Spam folder cleaning script.

Hi All,

I was wondering if anyone had  a spam mailbox cleaning script 
that they would like to share. I am already using 
immsgexp.exe to clean-up all user mailboxes that have 
messages over 60 days old. I have just implemented moving 
mail to a Spam mailbox under each users account and would 
like to clean out any mail over 15 days old.

I can run forfiles.exe to get a list of all users with Spam 
mailboxes, but the @path variable is including the file name 
not just the directory path. With immsgexp.exe you need to 
specify the folder path as one switch and then the mailbox 
with a second switch. So I need to be able to retrieve just 
the folder path. Which brings me back to my original 
question, anyone want to share?

Thanks,

Dean

--
__________________________________________
Dean Lawrence, CIO/Partner
Internet Data Technology
888.GET.IDT1 ext. 701 * fax: 888.438.4381 
http://www.idatatech.com/ Corporate Internet Development and 
Marketing Specialists


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


    


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



  

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

Reply via email to