A one-line program to count lines of code

I wanted to sum the total lines of code in files in a given folder. I thought that writing my own program to do this would be faster than looking for it on the internet, so here's what I came up with (1 line broken into 7 lines to fit into your blog reader):

 using System;
using System.Linq;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine(
            Directory.GetFiles(
                Environment.CurrentDirectory, "*", 
                string.Join(" ", args).Contains("/s") 
                    ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)
            .Select(f => File.ReadAllLines(f).Length)
            .Sum());
    }
}

Just name the executable loc.exe and put it into your PATH - you're good to go. Input "loc" in the command prompt to get the total number of LOC in the current directory, and "loc /s" to do recursive search.

Please note that the way I wrote this program is not very good for debugging, because you can't put a breakpoint on substatements (technically speaking, this program consists of only one statement). In production code, I would rather write something like this:

 string path = Environment.CurrentDirectory;
string pattern = "*";
string commandLine = string.Join(" ", args);
SearchOption searchRecursively = commandLine.Contains("/s") 
            ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;

string[] files = Directory.GetFiles(path, pattern, searchRecursively);
IEnumerable<int> lengths = files.Select(f => File.ReadAllLines(f).Length);
int totalLOC = lengths.Sum();

Console.WriteLine(totalLOC);

because it better conveys the step-by-step actions and allows to put a breakpoint on any step. However, for my little program, my sense of style guided me to use the former notation.

As another side note, the "production version" doesn't use var for type inference. I think it improves readability in this case.