@Jaz: Halfway there with this
1,2,3 |
foreach {
$count = $_;
$x = gci -Path \\myserver-web$count\d$\IISLogs\ -include *.log -recurse
$x | ForEach-Object {
Copy-Item $x -Destination $("D:\ServerLogsAndBackups\IIS\w"+$count+"\"+$_.Directoryname+"_"+$_.Name) -whatIf
}
}
however it's appending too much to the destination: D:\ServerLogsAndBackups\IIS\w1\uktv-web1\d$\IISLogs\W3SVC1135081669_ex110330.log
when i want it to be: D:\ServerLogsAndBackups\IIS\w1\W3SVC1135081669_ex110330.log
any tips?