VB Script needed to edit files in a folder and then move them to another folder

Associate
Joined
6 Oct 2006
Posts
375
Location
Luton
Hi

I hope somebody can help. I have a requirement to modify some eml files located inside a folder and then move them to another folder.

inside c:\folderA there are one or more eml files.

I need the script to find the line that starts with:


and change it to:


The email address could be anything, and then move it to c:\FolderB
It would then move onto the next file if there is one. The script would then be set on a schedule to do this every 5 minutes or so.

I have been told that this is possible but I have no idea how to achieve this (Scripting is not my area...)

Can anybody help at all....

Cheers
Richard
 
Thanks for this everyone.

I understand we can use the replace function, but whatabout if we do not know what the email address would be. The constant we would know would be the the start of the line contains From:. Anything after this we would not know but we would still need to get quotes around it.

Also, how would we go about reading multiple files. I am assuimg that this would be some sort of Loop...


Thanks
Richard
 
Screw VBS. It's old and PowerShell is way better :D

I really need to start learing this at some point. I think more and more will be go the Powershell route.

At the moment I only really no a little of VB, and i really mean just a little...

Thanks for that code there. I will have a play with it. How would you go about finding out what is after the From: on that line of the file and then put quotes around it. As I have just said above i wold not know what the email address would be, so i would need the script to find this out before we can do a replace...

I appreciate all your efforts.

Thanks
Richard
 
Thank you everyone for your help. Sorry I haven't replied sooner.

Here is an example of an eml file that will be in the folder. The line that needs changing is the 11th down and the email address needs "" around it. The rest of the line needs to stary the same. Also this email address could well be different on each file in the folder.

x-sender: [email protected]
x-receiver: [email protected]
Received: from mail.company.com ([10.xx.xx.xx]) by helpdesk.company.co.uk with Microsoft SMTPSVC(7.5.7601.17514);
Wed, 31 Aug 2011 10:55:33 +0100
To: [email protected]
Subject: Hello
MIME-Version: 1.0
X-KeepSent: DA179624:87FC33EC-802578FD:00368078;
type=4; name=$KeepSent
X-Mailer: Lotus Notes Release 8.5.2 August 10, 2010
From: [email protected]
Message-ID: <OFDA179624.87FC33EC-ON802578FD.00368078-802578FD.003685C1@copmany.com>
Date: Wed, 31 Aug 2011 10:55:32 +0100
X-MIMETrack: Serialize by Router on XXX01/Servers/Company(Release 8.5.2FP2|March 22, 2011) at
31/08/2011 10:55:33,
Serialize complete at 31/08/2011 10:55:33
Content-Type: multipart/alternative; boundary="=_alternative 003685A3802578FD_="
Return-Path: [email protected]
X-OriginalArrivalTime: 31 Aug 2011 09:55:33.0240 (UTC) FILETIME=[1FD7F780:01CC67C4]
This is a multipart message in MIME format.
--=_alternative 003685A3802578FD_=
Content-Type: text/plain; charset="US-ASCII"
This is a test
Thanks
Richard
--=_alternative 003685A3802578FD_=
Content-Type: text/html; charset="US-ASCII"
<font size=2 face="sans-serif">This is a test</font>
<br>
<br><font size=2 face="sans-serif">Thanks</font>
<br><font size=2 face="sans-serif">Richard</font>
--=_alternative 003685A3802578FD_=--

If anybody could help with this i would really appreciate it

Let mek now if you need anymore info.

Cheers
Richard
 
Last edited:
Back
Top Bottom