Write-Host "Take app offline"
if(!(Test-Path "$($targetFolder)\app_offline.htm")) {
New-Item -Path "$($targetFolder)" -Name "app_offline.htm" -ItemType "file"
}
Write-Host "Delete..."
Start-Sleep -Seconds 5
Get-ChildItem -Path "$($targetFolder)" -Exclude app_offline.htm -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Stop
Start-Sleep -Seconds 1
Write-Host "Copy new files"
Expand-Archive -Path $sourceArchive -DestinationPath $targetFolder
Start-Sleep -Seconds 1
Write-Host "Take app online"
Remove-Item -Path "$($targetFolder)\app_offline.htm"
Write-Host "Take app offline"
if(!(Test-Path "$($targetFolder)\app_offline.htm")) {
New-Item -Path "$($targetFolder)" -Name "app_offline.htm" -ItemType "file"
}
Write-Host "Delete..."
Start-Sleep -Seconds 5
Get-ChildItem -Path "$($targetFolder)" -Exclude app_offline.htm -Recurse -Force | Remove-Item -Recurse -Force -ErrorAction Stop
Start-Sleep -Seconds 1
Write-Host "Copy new files"
Expand-Archive -Path $sourceArchive -DestinationPath $targetFolder
Start-Sleep -Seconds 1
Write-Host "Take app online"
Remove-Item -Path "$($targetFolder)\app_offline.htm"