Configure $source
e $dest
conforme necessário, incluindo barra final.
$source = "H:\personal\"
$dest = "H:\archive\"
Get-ChildItem -Recurse -Path $source |
Where-Object { $_.PsIsContainer -eq $false -and $_.Name -eq "dat" } |
ForEach-Object { $_.CopyTo( $( $dest + $_.Directory.Name + ".dat" ), $true ) }