Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

how to overwrite files with copy-item in powershell

$
0
0

Hi

I am trying to copy content of a folder but there are two files which i would like to exclude. rest all the content should be copied to a new location and existing content on that new location should be overwritten. 

this is my script. it works fine if my destination folder is empty. but if i have files and folder it doesnt over writes them

$copyAdmin = $unzipAdmin + "/Content/*" 
$exclude = @('Web.config','Deploy')
Copy-Item  -Path $copyAdmin -Destination $AdminPath -Exclude $exclude -Recurse -force


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>