forked from Sitefinity/feather
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctions.ps1
More file actions
27 lines (25 loc) · 720 Bytes
/
Functions.ps1
File metadata and controls
27 lines (25 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Import-Module WebAdministration
Function CleanDirectory($dir){
Cmd /C "rmdir /S /Q $dir 2>NUL"
}
function CleanWebsiteDirectory($dir, $retryCount, $appPollName)
{
for ($i=1; $i -le $retryCount; $i++)
{
if(Test-Path $dir)
{
Restart-WebAppPool $appPollName
Start-Sleep -s 3
CleanDirectory $dir
if($i -eq $retryCount)
{
$errorMsg = "Unable to clean "+ $dir +" directory..."
Throw New-Object System.Exception($errorMsg)
}
write-output "Cleaning $dir... [ Retry$i ]"
} else {
write-output "$dir cleaned successfully."
break
}
}
}