Skip to main content

Archive log files

:: Daily archive log files older than n days
:: Created date: YYYYMMDD
:: Created by:
:: Last modified: YYYYMMDD
:: Last modified by:
:: History:
::

SET DIRLOG=D:\_scripts\Logs\
SET ziptype=gz
SET days=1

:: archive files
ECHO "Begin" >> %dirlog%daily-archive-logfiles.txt
DATE /T >> %dirlog%daily-archive-logfiles.txt
TIME /T >> %dirlog%daily-archive-logfiles.txt
FORFILES /P %DIRLOG% /S /M *.log /D -%days% /C "cmd /c ^0x22C:\Program^ Files\7-Zip\7z.exe^0x22 a -tgzip @path.gz @path" >> %dirlog%daily-archive-logfiles.txt
ECHO "Finished" >> %dirlog%daily-archive-logfiles.txt
DATE /T >> %dirlog%daily-archive-logfiles.txt
TIME /T >> %dirlog%daily-archive-logfiles.txt
:: END of script

Popular posts from this blog

IIS: Delete cached files on server running IIS

Delete cached files on server running IIS When changing css, javascript files, check to delete if IIS still caches old files in the default folder C:\inetpub\temp\IIS Temporary Compressed Files\<sitename>\$^_gzip_D^\ Apply to: IIS 8.5

Linux command: du - disk usage

Where have all my storage gone? du summarize disk usage of the set of FILEs, recursively for directories.

ManageEngine ServiceDesk Plus - Reset password

Let's reset the default administrator's password to 'admin'