CmdLets/Copy-ItemWrapper.ps1
|
Function Copy-ItemWrapper { [CmdletBinding()] Param( [Parameter(Mandatory=$True)][String]$Path, [Parameter(Mandatory=$True)][String]$Destination ) $Path = $Path.Replace("[LocalRoot]",$LocalRoot).Replace("[RemoteRoot]",$RemoteRoot) $Destination = $Destination.Replace("[LocalRoot]",$LocalRoot).Replace("[RemoteRoot]",$RemoteRoot) if (!(test-path $Destination)) { Write-Verbose "Creating: $Destination" New-ItemWrapper $Destination } If (!(Test-Path $Path) -and $Path -like "\\*"){ Connect-LibraryApplicationShare -Path $Path } Write-Host "Copying: $($Path)" Get-Item $Path | Copy-Item -Destination "$Destination" -Force -Recurse } |