Acabei fazendo isso com um arquivo de lote e configurando-o para ser executado pelo Agendador de Tarefas. Aqui está o arquivo de lote, se alguém estiver interessado:
@echo off
set RETENTION_PERIOD_DAYS=30
set FILE_BASED_ARCHIVES=g:\shares\public\crashes
set DIRECTORY_BASED_ARCHIVES=g:\shares\results
set MINIMUM_FILESIZE=1000000
set ZIP_PATH="c:\Program Files-Zipz.exe"
if not {%1}=={} call :archive %1 %2 %3 %4&exit /b 0
echo Archiving files older than %RETENTION_PERIOD_DAYS% days.
echo File Based: %FILE_BASED_ARCHIVES%
echo Directory Based: %DIRECTORY_BASED_ARCHIVES%
for %%a in (%FILE_BASED_ARCHIVES%) do (
echo ********* Archiving %%a
du /s "%%a"
echo -----------------------
forfiles /p %%a /s /m *.* /d -%RETENTION_PERIOD_DAYS% /c "cmd /c call ^0x22%~dpnx0^0x22 ^0x22FILE^0x22 ^0x22@isdir^0x22 ^0x22@fsize^0x22 @path"
echo -----------------------
du /s "%%a"
echo ****************************************************
)
for %%a in (%DIRECTORY_BASED_ARCHIVES%) do (
echo ********* Archiving %%a
du /s "%%a"
echo -----------------------
forfiles /p %%a /d -%RETENTION_PERIOD_DAYS% /c "cmd /c call ^0x22%~dpnx0^0x22 ^0x22DIR^0x22 ^0x22@isdir^0x22 ^0x22@fsize^0x22 @path"
echo -----------------------
du /s "%%a"
echo ****************************************************
)
exit /b 0
:archive
if /i "%~1"=="FILE" (
if /i "%~2"=="FALSE" (call :archive_file %3 %4) else (echo Skipping %~4 as it is not a file.)
)
if /i "%~1"=="DIR" (
if /i "%~2"=="TRUE" (call :archive_dir %4) else (echo Skipping %~4 as it is not a directory.)
)
exit /b 0
:archive_file
set FILESIZE=%~1
if %FILESIZE% GEQ %MINIMUM_FILESIZE% (
call :7zip %2 && del /q /f %2
) else (
echo Skipping %~2 as it is smaller than %MINIMUM_FILESIZE% bytes.
)
exit /b 0
:archive_dir
call :7zip %1 && rd /q /s %1
exit /b 0
:7zip
%ZIP_PATH% t "%~1">nul || (
%ZIP_PATH% a -t7z -mx9 -sfx "%~dp1%~n1.exe" "%~dpnx1" || exit /b 1
)
exit /b 0