Forum Discussion
CS_HelpDesk
2 years agoGoTo Contributor
Copy a file to a destination.
---
$source = $null
$destination = $null
$overwrite = $false
If (-Not (Test-Path -Path $destination -PathType Container))
{
New-Item -Path $destination -ItemType Directory
}
$exclude = If($overwrite) { {} } else { Get-ChildItem $destination }
Copy-Item $source -Destination $destination -Exclude $exclude.FullName -Force:$overwrite –Verbose