Automated task to clean up directories
If the Cleanup of Directories for the output directory SynOutputService does not work correctly and a lot of data garbage is stored in the corresponding directory at ArcGIS Server and is not cleaned automatically by the cleanup task (setting List of ArcGIS Server Output Services in the WebOffice author standalone Application configuration), it is recommended to set up a workaround as an automated Windows task.
The following powershell script lines are exemplary for this:
$Files = get-childitem \\<machine>\arcgisserver\directories\arcgisoutput\WebOffice\SynOutputService_MapServer | Where-Object PSIsContainer -eq $false
$LimitTime = (Get-Date).AddHours(-1)
$Files | ForEach-Object {
if ($_.CreationTime -lt $LimitTime -and $_.LastWriteTime -lt $LimitTime) {
Remove-Item -Path $_.FullName -Force
}
}
Now save the script as a Windows PowerShell script *.ps1 file and configure an automatic task on the machine that cleans the directory daily.
Create a new task - general settings
Create a new task - set a trigger
Create a new task - Start a program