Hi,
Here's what I came up with. This batch file removes duplicate addresses
from the users.lst files,
adds a domain to unqualified addresses, adds <> to all the addresses, and
alphabetizes the users.txt /users.lst files.
(Yes, my lists were a mess.)
One question that I do have is what is the relationship between the
users.txt and users.lst files? I noted a previous post
on removing duplicate addresses, and the solution was rather complex.
The log the batch file creates doesn't work quite right, but I didn't have
time to figure that part out.. On my Dual Xeon 700
system the file took about 12 min. to run. (1000+ users, 132 lists)
The file seems to work as it should, but I have no doubt that it could be
optimized to run faster.
Burzin
cls
@echo off
cd d:\Imail
del c:\Imail\alpha.log
dir d:\imail\lists\users.lst /s /b | find "\_vti_cnf\users.lst" /v /i >
usrlst.tmp
dir d:\imail\lists\users.txt /s /b > usrtxt.tmp
Echo.
Echo Clean up in progress.
Echo Deleting Tmp and Users.Bak files.
Echo See D:\Imail\Alpha.Log for details.
Echo.
Echo. >> d:\imail\alpha.log
time /t >> d:\imail\alpha.log
date /t >> d:\imail\alpha.log
Echo ****** Deleted the following files ******** >> d:\imail\alpha.log
del d:\imail\lisuser.tmp /s > files.tmp
del d:\imail\lisuser1.tmp /s >> files.tmp
del d:\imail\lists\users.bak /s >> files.tmp
Echo ******************************************* >> d:\imail\alpha.log
echo. >> d:\imail\alpha.log
Echo Removing duplicate addresses from Users.lst files.
Echo See D:\Imail\Alpha.Log for details.
Echo Removing Duplicate Addresses >> d:\imail\alpha.log
for /f "eol=; tokens=1*" %%i in (usrlst.tmp) do cd %%~pi && For /F
"tokens=*" %%s in ('Sort^<%%i') Do @Find "%%s" lisuser.tmp||@echo
%%s>>lisuser.tmp && copy lisuser.tmp users.lst
Time /t >> d:\alpha.log
date /t >> d:\alpha.log
cd d:\imail
del lisuser.tmp /s
Echo.
Echo Adding slcl.lib.mo.us to unqualified addresses in users.lst files.
Echo See D:\Alpha.Log for details
Echo.
Echo. >> D:\imail\alpha.log
Echo ****** Added slcl.lib.mo.us to unqualified addresses in the following
files ***** >> d:\imail\alpha.log
for /f "eol=; tokens=1*" %%i in (usrlst.tmp) do cd %%~pi && type users.lst
| find /v "@" | sort >> lisuser.tmp && type users.lst | find "@" | sort >>
lisuser1.tmp && if exist lisuser.tmp for /f "eol=; tokens=1*" %%j in
(lisuser.tmp) do echo [EMAIL PROTECTED] >> lisuser1.tmp && copy
lisuser1.tmp users.lst && Echo Added slcl.lib.mo.us to addresses in %%i >>
d:\imail\alpha.log
Echo ******************************************* >> d:\imail\alpha.log
echo. >> d:\imail\alpha.log
cd d:\imail
Echo.
Echo Clean up in progress.
Echo Deleting Tmp and Users.Bak files.
Echo See D:\Imail\Alpha.Log for details.
Echo.
Echo. >> d:\imail\alpha.log
time /t >> d:\imail\alpha.log
date /t >> d:\imail\alpha.log
Echo ****** Deleted the following files ******** >> d:\imail\alpha.log
del d:\imail\lisuser.tmp /s > files.tmp
del d:\imail\lisuser1.tmp /s >> files.tmp
del d:\imail\lists\users.bak /s >> files.tmp
Echo ******************************************* >> d:\imail\alpha.log
echo. >> d:\imail\alpha.log
Echo Adding brackets (^<^>) to users.lst files. See alpha.log for details
Echo ****** Added brackets (^<^>) to the following files ***** >>
d:\imail\alpha.log
for /f "eol=; tokens=1*" %%i in (usrlst.tmp) do cd %%~pi && type users.lst
| find /v "<" | sort >> lisuser.tmp && type users.lst | find "<" | sort >>
lisuser1.tmp && for /f "eol=; tokens=1*" %%j in (lisuser.tmp) do echo
^<%%j^> >> lisuser1.tmp && copy lisuser1.tmp users.lst && Echo Added
brackets (^<^>) to %%i >> d:\imail\alpha.log
Echo ******************************************* >> d:\imail\alpha.log
echo. >> d:\imail\alpha.log
echo.
cd d:\Imail
Echo Alphabetizing user.lst files. See Alpha.log for details.
Echo ***** Alphabetized the following files ******
for /f "eol=; tokens=1*" %%i in (usrlst.tmp) do type %%i | sort >>
lisuser.tmp && copy lisuser.tmp %%i && del lisuser.tmp && echo %%i
alphabetized >> d:\imail\alpha.log
Echo ******************************************* >> d:\imail\alpha.log
Echo. >> d:\imail\alpha.log
cd d:\imail
Echo.
Echo Clean up in progress.
Echo Deleting Tmp and Users.Bak files.
Echo See D:\Imail\Alpha.Log for details.
Echo.
Echo. >> d:\imail\alpha.log
time /t >> d:\imail\alpha.log
date /t >> d:\imail\alpha.log
Echo ****** Deleted the following files ******** >> d:\imail\alpha.log
del d:\imail\lisuser.tmp /s > files.tmp
del d:\imail\lisuser1.tmp /s >> files.tmp
del d:\imail\lists\users.bak /s >> files.tmp
Echo ******************************************* >> d:\imail\alpha.log
echo. >> d:\imail\alpha.log
Echo Alphabetizing user.txt files.
Echo See D:\Imail\Alpha.log for details.
Echo ***** Alphabetized the following files ****** >> d:\imail\alpha.log
for /f "eol=; tokens=1*" %%i in (usrtxt.tmp) do type %%i | sort >>
lists.tmp && copy lists.tmp %%i && del lists.tmp && echo %%i
alphabetized >> d:\imail\alpha.log
Echo ******************************************* >> d:\imail\alpha.log
Echo. >> d:\imail\alpha.log
cd d:\imail
Echo.
Echo Clean up in progress.
Echo Deleting Tmp and Users.Bak files.
Echo See D:\Imail\Alpha.Log for details.
Echo.
Echo. >> d:\imail\alpha.log
time /t >> d:\imail\alpha.log
date /t >> d:\imail\alpha.log
Echo ****** Deleted the following files ******** >> d:\imail\alpha.log
del d:\imail\lisuser.tmp /s > files.tmp
del d:\imail\lisuser1.tmp /s >> files.tmp
del d:\imail\lists\users.bak /s >> files.tmp
Echo ******************************************* >> d:\imail\alpha.log
echo. >> d:\imail\alpha.log
At 06:28 PM 08/12/2002 -0400, you wrote:
> > The && were what I needed to get for/do to *do* multiple commands. I'll
> > post the what I cobbled together tomorrow.
> >
> > Burzin
>
>This would be appreciated by list members. I'm sorry that all I could do was
>to point you to the KB articles that each contained part of the solution but
>I did not have time to develop a proper batch file for you, much less test
>it out. Who knows, your next post might make be included in the KB!
>
>Best,
>
>Guy
>
>
>
>
>Please visit http://www.ipswitch.com/support/mailing-lists.html
>to be removed from this list.
>
>An Archive of this list is available at:
>http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
>
>Please visit the Knowledge Base for answers to frequently asked
>questions: http://www.ipswitch.com/support/IMail/
------
Burzin Sumariwalla Phone: (314) 994-9411 x291
[EMAIL PROTECTED] Fax: (314) 997-7602
Pager: (314) 407-3345
Networking and Telecommunications Manager
Information Technology Services
St. Louis County Library District
1640 S. Lindbergh Blvd.
St. Louis, MO 63131
Please visit http://www.ipswitch.com/support/mailing-lists.html
to be removed from this list.
An Archive of this list is available at:
http://www.mail-archive.com/imail_forum%40list.ipswitch.com/
Please visit the Knowledge Base for answers to frequently asked
questions: http://www.ipswitch.com/support/IMail/