I am looking for some help with a PowerShell Copy. I have done two day of online searching and still cannot figure it out. I am trying to copy files from one server to another.
Server A save .jpg files in a directory for its use.
example - 1111.111
Server B need the files with .jpg on them so iis can read them.
1111.111.jpg
when create the copy I does not read the 1111.111 and 1111.111.jpg as the same file and copies it again.
$Source = "Server A"
$Destination = "Server B"
$ExcludeItems = @()
if (Test-Path "$Destination")
{
$ExcludeItems += "*.jpg"
}
Copy-Item "$Source\*" -Destination "$Destination" -Exclude $ExcludeItems -Recurse -Force
Get-ChildItem -Exclude "*.jpg", "*.ps1", "*.xls" | Where-Object{!$_.PsIsContainer} | Rename-Item -NewName {$_.name +".jpg"}
Remove-Item $Destination\'Animal'
Remove-Item $Destination\'Employee'
Remove-Item $Destination\'*sealed*'
Remove-Item $Destination\'*seled*'