John Liu .NET

View Original

Write this cmdlet

# filter directories, look for cs files.
$files = get-chilitem . -include *.cs -recurse
$regex = new-object -type System.Text.RegularExpressions.Regex "pattern"
foreach($file in $files){

$content = get-content $file
# run regex

if (regex.IsMatch(content)) {

#write-out
$file

}

}

#sorry for the lack of spacing - I'm typing code in a blog editor and pressing spaces is too much work