<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Processing .EML files with Select-String and SetCreationTime()</title><link>http://blogs.msdn.com/b/powershell/archive/2006/11/23/processing-eml-files-with-select-string-and-setcreationtime.aspx</link><description>In our newsgroup Microsoft.Public.Windows.PowerShell, Steve Foster asked whether PowerShell could help him with a bunch of emails in .EML format. Here was his query: 
 
 Got a bunch of emails (.EML) that have been copied around various places with the</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Processing .EML files with Select-String and SetCreationTime()</title><link>http://blogs.msdn.com/b/powershell/archive/2006/11/23/processing-eml-files-with-select-string-and-setcreationtime.aspx#8594147</link><pubDate>Fri, 13 Jun 2008 09:43:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8594147</guid><dc:creator>Jeff Burgess</dc:creator><description>&lt;p&gt;Came upon this when searching for a way to fix Courier email dates imported to Kerio mailserver. &amp;nbsp;The following small modification worked fine. &amp;nbsp;The header was slightly different to what was expected, was picking up &amp;lt;EST&amp;gt; which caused the script to fail. &amp;nbsp;So just stop the Kerio mail server run the scripts in each #msgs directory you need to fix and then delete the associated index.fld in the parent directory. &amp;nbsp;Restart Kerio and you are done. &amp;nbsp;Many thanks Jeffrey Snover for your script, made life a hell of a lot easier.&lt;/p&gt;
&lt;p&gt;//to set modified date&lt;/p&gt;
&lt;p&gt;foreach ($record in Select-String ^Delivery-date: *.eml) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp;[System.IO.File]::SetLastWriteTime($Record.Path, [datetime]($record.line.substring(15)))&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;//to set create date&lt;/p&gt;
&lt;p&gt;foreach ($record in Select-String ^Delivery-date: *.eml) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp;[System.IO.File]::SetCreationTime($Record.Path, [datetime]($record.line.substring(15)))&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8594147" width="1" height="1"&gt;</description></item><item><title>re: Processing .EML files with Select-String and SetCreationTime()</title><link>http://blogs.msdn.com/b/powershell/archive/2006/11/23/processing-eml-files-with-select-string-and-setcreationtime.aspx#1151717</link><pubDate>Sun, 26 Nov 2006 10:42:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1151717</guid><dc:creator>Keith Hill</dc:creator><description>&lt;p&gt;The next drop of PowerShell Community Extensions (&lt;a rel="nofollow" target="_new" href="http://www.codeplex.com/powershellcx"&gt;http://www.codeplex.com/powershellcx&lt;/a&gt;) will have a Set-FileTime cmdlet. &amp;nbsp;The current drop has a Set-FileDate cmdlet that is pretty much the same but I decided the cmdlet name should be Set-FileTime.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1151717" width="1" height="1"&gt;</description></item><item><title>Let's do a deep drill into Select-String</title><link>http://blogs.msdn.com/b/powershell/archive/2006/11/23/processing-eml-files-with-select-string-and-setcreationtime.aspx#1129041</link><pubDate>Thu, 23 Nov 2006 20:25:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1129041</guid><dc:creator>Windows PowerShell</dc:creator><description>&lt;p&gt;In my blog post Processing .EML files using Select-String and SetCreationTIme ( ) ( &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/powershell/archive/2006/11/23/processing-eml-files-with-select-string-and-setcreationtime.aspx"&gt;http://blogs.msdn.com/powershell/archive/2006/11/23/processing-eml-files-with-select-string-and-setcreationtime.aspx&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1129041" width="1" height="1"&gt;</description></item></channel></rss>