$TargetFolder = 'F:\temp\test1'
$DestinationFolder = 'F:\temp\test2'
Get-ChildItem $TargetFolder -Recurse |
Where-Object { $_.Name -match '.log$' -and !$_.PsIsContainer } |
Copy-Item -Destination { mkdir $_.DirectoryName.Replace("$TargetFolder","$DestinationFolder") -Force }