-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the existing site files minus App_Data and web.config.
- Loading branch information
1 parent
1d9742f
commit de45c97
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
$packageName = $env:ChocolateyPackageName | ||
$webInstallDir = Join-Path (Get-ToolsLocation) $packageName | ||
|
||
if (Test-Path $webInstallDir) { | ||
try { | ||
Write-Debug "Removing all but the App_Data folder in the existing '$webInstallDir'" | ||
Get-ChildItem -Path "$webInstallDir" -Recurse | % { | ||
if ($_.FullName -match 'App_Data' -or $_.FullName -match 'Web.config') { | ||
Write-Debug " - Skipping $($_.FullName)" | ||
} else { | ||
Write-Debug " - Removing $($_.FullName)" | ||
Remove-Item $_.FullName -Recurse -Force -ErrorAction SilentlyContinue | ||
} | ||
} | ||
} | ||
catch { | ||
Write-Warning "Had an error deleting files from '$webInstallDir'. You will need to manually remove files. Error: $_" | ||
} | ||
|
||
Write-Warning "Removed all from '$webInstallDir' except for App_Data. You should inspect and remove packages/logs manually." | ||
} |