【发布时间】:2016-02-20 18:38:28
【问题描述】:
我有一个包含 350 个文件夹的列表,每个文件夹都有一个文件访问日志。我需要在所有 350 个文件夹下的所有 350 个文件中搜索名称“Hound”,并在其访问日志文件中显示包含名称“Hound”的文件夹的名称。 下面是我的代码,有人可以帮我在这里添加什么以获得所需的输出吗?
#List all the folders in C:\testfolder
$folders = (Get-ChildItem -Path "C:\testfolder" | Where-Object{$_.Attributes -eq "Directory"} | Select Fullname)
#looping all folders
Foreach ($folder in $folders)
{
#Here I need to look for the word "Hound" inside the Access.log file and if the word is there, it should display the name of the $folder which has the word
}
【问题讨论】:
标签: full-text-search powershell-2.0 powershell-4.0