Operation Manual

87 Copyright © Acronis International GmbH, 2002-2014
ECHO OFF
REM Script: aETomcatLogsPurge.bat
REM 2012-05-12: Version: 1.0: MEA: Created
ECHO This script will delete files older than a number of days from a directory
ECHO Run it from the command line or from a scheduler
ECHO Make sure the process has permissions to delete files in the target folder
REM ===== CONFIGURATIONS ===================================================
REM Note: all paths containing spaces must be enclosed in double quotes
REM Edit this file and set LogPath and NumDays below
REM Path to the folder where all Tomcat logs are
set LogPath="C:\Program Files (x86)\Group Logic\Common\apache-tomcat-7.0.34\logs"
REM NumDays - Log files older than NumDays will be processed
set NumDays=14
REM ===== END OF CONFIGURATIONS ======================
ECHO
ECHO ===== START ============
REM ForFiles options:
REM "/p": the path where you want to delete files.
REM "/s": recursively look inside other subfolders present in the folder
mentioned in the batch file path
REM "/d": days for deleting the files older than the present date. For instance
"/d -7" means older than 7 days
REM "/c": command to execute to actually delete files: "cmd /c del @file".
forfiles /p %LogPath% /s /d -%NumDays% /c "cmd /c del @FILE"
:End
ECHO ===== BATCH FILE COMPLETED ============================================
Warning: We provide this example as a guideline so you can plan and implement your own process based on
the specifics of your deployment. The example is not meant nor tested to apply to all situations and
environments so use it as a foundation and at your own risk. Do not use it in production environments without
comprehensive offline testing first.
Steps:
1. Copy the script to the computer running Acronis Access (Tomcat) and open it with Notepad or a
suitable plain text editor.
2. Locate the section illustrated in the picture below and edit the LogPath and NumDays variables
with your specific paths and retention settings: