Reputation: 2226
Currently i am copying all the $DeploymentPath
(folder) locally, and then
deleting all the files in it, except 1 file that i want.
MsDeploy-Sync `
-SourceContentPath:"$DeploymentPath" `
-DestinationContentPath:"$SupportFolder/WebPages" `
Get-ChildItem "$SupportFolder\WebPages" -Exclude "web.config.js" |
Remove-Item
What i want to do:
copy only 1 file web.config.js
locally, if it doesn't exist there, return false.
ps1
file, but i have to use MsDeploy
commands.Is it possible?
Upvotes: 1
Views: 77
Reputation: 58991
First of all, you should use the Join-Path cmdlet to combine a path in PowerShell.
To check whether the file exist, just use the Test-Path cmdlet:
$webConfigPath = Join-Path $SupportFolder '\WebPages\web.config.js'
if (Test-Path $webConfigPath)
{
MsDeploy-Sync `
-SourceContentPath (Join-Path $DeploymentPath 'web.config.js') `
-DestinationContentPath (Join-Path $SupportFolder 'fromServer_web.config.js')
}
else
{
$false # return $false
}
Upvotes: 1