Category Archive PowerShell

ByRob Peledie

365Knowledge YouTube Channel Update

It’s been a number of years since 365Knowledge posted any videos on YouTube, so I thought it was time we started again.

Interestingly, although I had neglected the channel, the 6 videos had a total watch of over 13,000 views which is small in comparison to most channels, but still quite a number.

So……………Watch this space!

ByRob Peledie

Count File Rows with PowerShell

Very quick post (more so I don’t forget how to do this!)

Had a CSV file which I knew had a lot of rows!….. more than excel could handle to open, so I wanted to know the exact number, but without opening.

PowerShell to the rescue:

$lines = 0
$fileReader = New-Object IO.StreamReader 'NAME_OF_YOUR_CSV.csv'
while ($fileReader.ReadLine() -ne $null)
{
	$lines++
}
$fileReader.close()
echo $lines

Result for me….. after a short while 🙂 4,366,151