I cannot agree with you, Daniel. Clearing cache is possible by external program launched by The Bat! as event in Scheduler. For this purpose the Windows PowerShell is ideally matched. First, you should create text file with name
ClearCacheDir.ps1 and save it in location, say,
<ScriptPath>. Here is the code for clearing files older than 7 days (you can change this as you wish):
| Code |
|---|
$now = Get-Date
$CacheDir = $env:email + "\imgfiles\"
dir $CacheDir | where {$_.LastWriteTime -le $now.AddDays(-7)} | del |
Then you should create an event in The Bat! Scheduler with only one operation:
run the PowerShell script. The command for this is following:
| Code |
|---|
C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '<ScriptPath>\ClearCacheDir.ps1'" |
Remember to use correct path "<ScriptPath>" in the command run by Scheduler.