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

how to avoid copying specfic file using powershell

$
0
0

Hi i would like to copy content from a folder but there is 1 specific file called Web.config which i do not want to copy.

i am using the following script but no luck

$unzipAdmin = 'c:\Temp\unzipAdmin'

$copyAdmin = $unzipAdmin + "/Content/*" 

get-childitem "C:\deployments\website" -recurse | % {
if($_.Name -ne 'Web.config')
{

Copy-Item  -Path $copyAdmin -Destination 'C:\Projects\Admin' -Recurse -force
}

}

all files and folders are inside content, so i would like to copy every thing except Web.config and 1 folder which is called Deploy


Viewing all articles
Browse latest Browse all 15028

Trending Articles



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