Compressing log files on Windows

1. Create a .bat file in the directory where the log folder is located.

2. Edit that .bat file, paste the following contents into it, and then save the changes.

@echo
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"

set "fullstamp=%MM%-%DD%-%YYYY%_%HH%-%Min%-%Sec%"

echo compressed file to zip that folder
set path=%cd%
:: uncomment the below line enter the path if the bat file is in different location
rem set path=

cd %path%
zip -r compressed_%fullstamp%.zip *.* -x "*.zip" "*.bat"

3. Running the .bat file will compress all the files within the folder.

Monitoring with Applicare

Was this article helpful?

Votes and follows are kept by Zendesk, so they need a Help Center account. These buttons open this article there.

Opens Zendesk · needs internet and sign-in

Still stuck? Contact support