Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Faster search?

$
0
0

I’m trying to search and get the count of files with a specific search string.

$String = Read-Host -prompt "What string to search for" $Count = (Get-ChildItem -Recurse | Where-Object { $_ | Select-String -Pattern $String } | Measure-Object).count Echo $Count 

The problem is that this cmdlet seems slow. I tried this script to run and search for “abc”, in 40000 xml files. It took about 5 to 8 minutes per run.

I’m new to Powershell and I’m not sure if there’s a faster way to achieve what I’m looking for?

submitted by /u/dogooder007
[link] [comments]

The post Faster search? appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles