Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20693

Re: Count of files matching a filename pattern.

$
0
0

Here's something that I wrote in PowerShell that should work for what you need.  It needs some cleanup, but give you a good bit of groundwork for what will be needed.

$Server="${IP}"# From Orion SAM Variables

$PathToFiles="\C$\Intel\Logs"

$SearchPattern="*.AML.log"

$Path=Join-Path-Path"\\$Server"-ChildPath$PathToFiles

$FileCount= ( [System.IO.Directory]::EnumerateFiles($Path,$SearchPattern) |Measure-Object ).Count

Write-Host"Message: $FileCount files exist in ""$Path"" matching pattern ""$SearchPattern"""

Write-Host"Statistic: $FileCount"

exit0

 

You can also use the $PathToFiles and the $SearchPattern as parameters in the Component Template.

--KMSigma


Viewing all articles
Browse latest Browse all 20693

Trending Articles