One of the Symantec Live Update Servers started to complain about low disk space. So I started Treesize Pro to see what files or folders where eating my disk space. After a couple of seconds Treesize Pro showed me that the liveupdate files, in the c:\LiveUpdate folder where the problem.
I created the following Powershell Script (after reading the source) and scheduled this script to run once a week.
Warning: This script will remove everything that matches the remove-item cmdlet!
$Now = Get-Date $Days = "3" $TargetFolder = "C:\LiveUpdate" $LastWrite = $Now.AddDays(-$days) $Files = get-childitem $TargetFolder -include *.zip, *.x86 -recurse ` | Where {$_.LastWriteTime -le "$LastWrite"} foreach ($File in $Files) {write-host "Deleting File $File" -foregroundcolor "Red"; ` Remove-Item $File | out-null}
Just change the $Days, $TargetFolder variables and the file extensions (*.zip, *.x86) for you environment.
Source of this script: powershell-script-to-delete-files-older-than-certain-days.aspx
Thanks Arne! I will use this ps script. I run into the same problem some weeks ago; my local contact in US complained the defs were not updated for some time. I will blog on my own site, but it makes sense for other guys to add the command how to schedule the job.
Hi.
That is great script. but i dont know why it does not delete folders, it deletes only files 😦 is there a chance to do something that this scripts deletes also folders,
best Regards