#region Description
#  This script cleans the "temp" and "Test" folder from each server (listed in 
#  the variables below).
#  NOTE: The tst-expere server "temp" folder is excluded from this script as 
#  that folder contains the output of the JHA Resources script. 
#endregion

#region VARIABLES
$server_root_dev = "\\zusscgrcprodwebhelp.file.core.windows.net\webhelp\dev"
$server_root_stg = "\\zusscgrcprodwebhelp.file.core.windows.net\webhelp\stg"
$server_root_exp = "\\zusscgrcprodwebhelp.file.core.windows.net\webhelp\tst-expere"
$server_root_tst = "\\zusscgrcprodwebhelp.file.core.windows.net\webhelp\tst"
$server_root_prd = "\\zusscgrcprodwebhelp.file.core.windows.net\webhelp\prod"
$textfile_string = "TempCleaner script cleared this folder on "
#endregion

#region dev folders
Remove-Item -Recurse -Force $server_root_dev/temp
Remove-Item -Recurse -Force $server_root_dev/Test
New-Item -Path $server_root_dev/temp -ItemType Directory
New-Item -Path $server_root_dev/Test -ItemType Directory
New-Item $server_root_dev/temp/TempCleaner.txt
$RightNow_dev = Get-Date
Set-Content $server_root_dev/temp/TempCleaner.txt $textfile_string+$RightNow_dev
#endregion

#region stg folders
Remove-Item -Recurse -Force $server_root_stg/temp
Remove-Item -Recurse -Force $server_root_stg/Test
New-Item -Path $server_root_stg/temp -ItemType Directory
New-Item -Path $server_root_stg/Test -ItemType Directory
New-Item $server_root_stg/temp/TempCleaner.txt
$RightNow_stg = Get-Date
Set-Content $server_root_stg/temp/TempCleaner.txt $textfile_string+$RightNow_stg
#endregion

#region tst-expere folders
# Remove-Item -Recurse -Force $server_root_exp/temp
Remove-Item -Recurse -Force $server_root_exp/Test
New-Item -Path $server_root_exp/temp -ItemType Directory
New-Item -Path $server_root_exp/Test -ItemType Directory
New-Item $server_root_exp/temp/TempCleaner.txt
$RightNow_exp = Get-Date
Set-Content $server_root_exp/temp/TempCleaner.txt $textfile_string+$RightNow_exp
#endregion

#region tst folders
Remove-Item -Recurse -Force $server_root_tst/temp
Remove-Item -Recurse -Force $server_root_tst/Test
New-Item -Path $server_root_tst/temp -ItemType Directory
New-Item -Path $server_root_tst/Test -ItemType Directory
New-Item $server_root_tst/temp/TempCleaner.txt
$RightNow_tst = Get-Date
Set-Content $server_root_tst/temp/TempCleaner.txt $textfile_string+$RightNow_tst
#endregion

#region prod folders
Remove-Item -Recurse -Force $server_root_prd/temp
Remove-Item -Recurse -Force $server_root_prd/Test
New-Item -Path $server_root_prd/temp -ItemType Directory
New-Item -Path $server_root_prd/Test -ItemType Directory
New-Item $server_root_prd/temp/TempCleaner.txt
$RightNow_prd = Get-Date
Set-Content $server_root_prd/temp/TempCleaner.txt $textfile_string+$RightNow_prd
#endregion