I have a folder named LOGFILES with a subfolder named LOGFILES_OLD.
But we need to assume that I don't know the contents of the folder.
What I'm trying to develop in PowerShell is a method to show a list of all files with a .log
extension.
I have failed to get it with something I have found here:
Get-Item C:\LOGFILES -Recurse | Where-Object {$_.Extension -eq ".log"} | Format-List
Why don't you use :
Get-ChildItem "C:\LOGFILES" -include *.log -Recurse