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

MSSQL: Fix error 'Consistency validation for SQL Server registry keys'

While installing Microsof SQL Server 2012, I ran into the following error. "The SQL Server registry keys from a prior installation cannot be modified. To continue, see SQL Server Setup documentation about how to fix registry keys." How to fix Replace the D:\x64\FixSqlRegistryKey_x86.exe file with the original file from the ENU\SQLFULL_ENU.iso file downloading from Microsoft Download Center. This ISO file is 4.2GB. So you can click FixSqlRegistryKey_x86.exe to download this file only. After replacing that file, press Re-run to check. All rules are passed.

Powershell: Check Bad Logon

get-aduser -Filter {BadLogonCount -ne 0} -properties * | select SamAccountName,BadLogonCount,BadPasswordTime,BadPwdCount,@{name='badPasswordTimeDT'; expression={[datetime]::fromFileTime($_.badPasswordTime)}} | sort BadPasswordTime | FT

GIMP - GNU Image Manipulation Program

Download GIMP for Windows, MacOS, and Linux.