Posted by: Colin Smith
One Liners, Powershell, Powershell Tips, Scripting, System Administration
Recently I needed to find out if I had any files of a certain extension in a particular folder and if so how many. With Powershell this is no problem at all.
Say I was looking for a count of .ps1 files in the directory.
The @() makes the result go into an array object. This way no matter what you will get an accurate count without having to do a for loop on that directory.