Logo: TechTrax...brought to you by MouseTrax Computing Solutions

Converting Email to Clean Text Files

by Dian Chapman, MVP, MOS
Skill rating level 7.

The other day, in a wonderfully collaborative effort by some of the folks who help out in Linda Johnson's Microsoft Office support group, we managed to come up with a pretty slick solution to a question I've heard asked a few time. So to share the wealth, the details are provided here. This article will explain how you can move email files from most email program into standard folders on your computer. The solution is not as easy as you might think, but then the fix we came up with is not as hard as we thought it might be!

The Problem
A user in the group wanted to save some emails as text files. But the only way he knew to do it was to click File/SaveAs and choose the Text format option. Since he wanted to move out a lot of files, this would have taken him a lot of time.

First of all, be sure to read a previous TechTrax article called: Organizing Outlook Mail, which explains how you can organize your email, easily, within categorized Outlook PST files. If you're battling one large file or need to access email in various locations, the information in that article may be just what you need. But if that solution doesn't flip your switch, maybe this one will?

The Solution
The solution came together in pieces via numerous emails from group members. As Linda said at the end "what a team!" If you need help with your Microsoft Office questions or want to try your hand at helping others, be sure to check out her Microsoft Office group link. It's a fun group and there's lot of great support going on in there! But if Windows is more your concern, Vic also runs one of the largest Windows support groups on the net. This link: WinTips and Tricks will take you to the sign up site for his group.

  • The first part of the solution came from me, Dian Chapman. I learned a long time ago about using the Drag 'n Drop feature in Windows to solve a lot of problems. You can slightly minimize Outlook so that you can see your desktop, while still able to access the email program. Right click your desktop and choose New/Folder and give the new folder a name. Return the focus to your email program. Grab a chunk of emails, which can be done by hitting Ctrl/A to Select All, or using the Shift key to grab continuous groups, or the Ctrl key to grab noncontiguous emails in a group. Then click to grab hold of them and drag them out of the email program until you are on top of the new folder you created on your desktop. (This move works with most popular email programs.) The folder will darken when you've hit it as your target move location. Then release the mouse key and all the selected email will be copied to the new folder.

We now have a pile of email messages in the desktop folder.

Note! Someone mentioned that when she moved the files, she was hit with message boxes asking if they wanted to rename the files, since some emails in a thread had the same subject; hence, they would be named the same in the new folder. I remembered having that problem, but it was only later Greg reminded me that if you pull a whole group at once, they will autonumber similar names, such as myEmail1, myEmail2, etc. But if you pull files over in small groups, a new file with the same name will want to overwrite a file that may already exist. So shoot for groups of same names so the system will automatically rename them in sequence.

The other issue here is resources. If your PC is not in good shape and you attempt to copy too many at once, you could crash the program or your computer. So be sure your system is in shape. Read this article for assistance: Maintaining Your Computer.

The files were moved, but they were all listed as MSG files, which is Outlooks file name. You could double click on them at this point and they will open up as individual emails. So this is a good way to move them out and still access the files. If you wanted, you could download and use Greg's award winning Cataloger to run against the directory and hyperlink all the files in a Word doc, with or without a table format. You could then add category keyword in table columns so you can easily sort the files (Table/Sort), find the one you needed and click to open it, from wherever it's located on your system. See this article for details behind it's use: Get Organized Now!

But the user wanted the files in text (txt) file format.

  • Vic Ferri passed along the next part of the puzzle. He reminded us of the DOS command for renaming groups of files. So we could now write a batch file to rename the whole folder from *.msg files to *.txt files, enmasse. To do this, click Start/Run. Type Notepad and hit enter. This will open the Windows Notepad text editor application. In the file, type:

           ren *.msg *.txt

    This is a DOS command and it'll rename all the files in the folder. But first you have to finish the batch file. Just save the Notepad file with that line in it. Be sure to save it to the same folder where your files are that you want to convert. And most importantly, name the file with a BAT extension, like Rename.bat. A bat file is a batch file that those of us who worked in DOS fondly remember. And lucky for us, Vic still remembers it well enough to remind those of us who have forgotten!

So now we have the emails moved out and we have all the files in the new folder renamed to what we want. However, when we converted the MSG files to TXT files, there are a fair amount of junk characters that get converted, particularly from HTML. These binary characters make the files somewhat difficult to read, as you have to fish out the alpha characters from all the squiggle characters to read the text.

  • Enter Greg Chapman and his WinScripts!

    Greg took one of the garbage text files and put together a Windows Scripting code file that goes through all the text files in the folder and extracts the binary gibberish, but leaves the important text information, as well as all the header information in the file. The result is a much cleaner text email message. Greg is giving away his WinScript files here, so anyone who wants it can benefit.

However, since a WSF file will run against any other files and will not download properly from a web page, he's made it available as a ZIP file. So if you want to use it, you can download it from the MouseTrax Download page at this link: MouseTrax Downloads. Be sure to read the directions he's posted on that page with the file!

After you download it, you can leave it on your desktop or put it somewhere safe. With WinNT/2000/XP, you can just drop the file(d) on the script to run it. With 9x systems, you'll need to run it at a command prompt. Detailed instructions are on the download page at the above link.

And again, once the files are nicely cleaned up, you can download Greg's cataloger and let that run against the folder to organize all the files within, into a Word doc with hyperlinks to the original file. Great way to get organized!

 

 

Go up to the top of this page.
This site powered by the Logical Web Publisher™: Content management by Logical Expressions, Inc.