I try to find all the file which contains $var and end with ".log" and I need it to be Recursive
I tried this
$logDirectoryPath = $Directory + "\*"
Get-ChildItem -Path $logDirectoryPath -Include *$iniContent["Search"]["FileWith"]*, *.log -Recurse -File -Name | ForEach-Object {
$lbox_files.Items.Add($_) # we add file to a list
}
But this command return every single files regardless of $var and Recurse seems disable :/
the file look like this : foo_test.log
another file : \user\foo_1.log
(PS : by $var I mean it depends of $iniContent["Search"]["FileWith"] value)
You can find all files by this comand:
Get-ChildItem -Path "c:\" -Recurse -File -Filter "*$var*.log"
It's return all files in folder that contain in name $var
and ends with ".log"