<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog &#124; Limilabs &#187; PowerShell</title>
	<atom:link href="http://www.limilabs.com/blog/tag/powershell/feed" rel="self" type="application/rss+xml" />
	<link>http://www.limilabs.com/blog</link>
	<description></description>
	<lastBuildDate>Mon, 21 May 2012 09:49:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Source lines of code count using PowerShell</title>
		<link>http://www.limilabs.com/blog/source-lines-of-code-count-using-powershell?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=source-lines-of-code-count-using-powershell</link>
		<comments>http://www.limilabs.com/blog/source-lines-of-code-count-using-powershell#comments</comments>
		<pubDate>Mon, 29 Mar 2010 18:35:43 +0000</pubDate>
		<dc:creator>Limilabs support</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.limilabs.com/blog/?p=777</guid>
		<description><![CDATA[Source lines of code (SLOC) is a software metric used to measure the size of a software program by counting the number of lines in the text of the program&#8217;s source code. As we all know the disadvantages of this metric, sometimes we simply want to know. Here&#8217;s a PowerShell script, that recursively searches for [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.limilabs.com/blog/wp-content/uploads/2010/03/PowerShell.jpg" alt="" title="PowerShell" width="137" height="102" class="alignleft size-full wp-image-781" />Source lines of code (<strong>SLOC</strong>) is a software metric used to measure the size of a software program by counting the number of lines in the text of the program&#8217;s source code.</p>
<p>As we all know the disadvantages of this metric, sometimes we simply want to know.</p>
<p>Here&#8217;s a <strong>PowerShell script</strong>, that recursively searches for *.cs files and counts the lines (<strong>empty lines and comments are excluded</strong>)</p>
<pre class="brush: plain;">
(dir -include *.cs -recurse | select-string &quot;^(s*)//&quot; -notMatch | select-string &quot;^(s*)$&quot; -notMatch).Count
</pre>
<p>Brief description of what all parts are doing:</p>
<ul>
<li>dir -include *.cs -recurse : Lists all *.cs files, you can add additional extensions using a comma.</li>
<li>select-string &#8220;^(s*)//&#8221; -notMatch : Exclude comments.</li>
<li>select-string &#8220;^(s*)$&#8221; -notMatch : Exclude empty lines.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.limilabs.com/blog/source-lines-of-code-count-using-powershell/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

