Powershell File – Dateien suchen und zählen

Dateien suchen und aufzählen

Write-Host “Waiting for -Recurse …”
$Path = “D:\Data\Desktop\*.exe”
$WinExe = Get-Childitem $Path -Recurse -ErrorAction SilentlyContinue `
| Where-Object {$_.Extension -Match “exe”}
Clear-Host
$WinExe.count

Clear-Host
$i=0
$Path = “D:\Data\Desktop”
$Full = Get-ChildItem $Path -Include *.txt -Recurse
$StringText = “Microsoft”
$List = select-string -pattern $StringText $Full
foreach ($file in $List) {$file.Path; $i++}
$i